- 浏览: 425646 次
- 性别:
- 来自: 珠海
文章分类
- 全部博客 (364)
- oracle (23)
- java (39)
- birt (10)
- uml (0)
- android (10)
- ubuntu (12)
- mysql (21)
- ant (1)
- lucence (1)
- Design Pattern (0)
- Data Struct (0)
- cvs svn vss (1)
- javascript (2)
- css (1)
- qtp (2)
- LoadRunner (0)
- spring3.0源码分析 (1)
- 编程经验 (2)
- 工作日志 (1)
- svn apache (2)
- vbscript (3)
- jbpm4.0-5.0 (0)
- 百度百科 (1)
- ivy (1)
- jni (0)
- drools5.1 (2)
- vss (1)
- 联系方式 (1)
- maven (2)
- jetty (1)
- webservice (0)
- Flex (45)
- 开发工具 (3)
- json (1)
- 项目配置应注意的问题 (1)
- freemarker 代码生成 (1)
- 自考 (0)
- 脚本语言 (0)
- weblogic (4)
- jar包冲突 (0)
- Nginx (2)
- Zxing (1)
- 嵌入式开发 (2)
- C# (4)
- 开发经验总结 注意事项 (1)
- CentOS 6.0 (4)
- BI (0)
- Hadoop (2)
- tomcat (3)
- db2 (1)
- sqlserver (1)
- php (5)
- thinkphp (0)
- amfphp (0)
- cognos (0)
- nutch (0)
- mongodb (9)
- nodejs (3)
- webrtc (0)
- websocket (0)
- html5 (0)
- css3 (0)
- nosql (2)
- ssdb (1)
- icommet (0)
- memcached (0)
- protocal (1)
- Linux --ssh (8)
- postgresql (8)
- sequoiadb (1)
- jquery (1)
- jvm jmx (1)
- spark (0)
- hbase (0)
- storm (0)
- netty (0)
- mina (0)
- shell (2)
- sacala (0)
- go (0)
- mac (1)
- netbean (1)
- mysql_postgresql (4)
- 消息队列 (0)
- neo4j (0)
- git (1)
- python (1)
- Perl (0)
- docker (4)
- video audio (1)
- actionscript (1)
- tensorflow (0)
- 机器学习 (0)
- 人工智能 (0)
- cas (1)
- 协程 (1)
- http (1)
- window (1)
- 内网穿透 (1)
- angular5 (0)
- vpn (2)
- AI (0)
- NLP (0)
- Spring Clound (0)
- mongoldb (1)
- 前端 (0)
最新评论
-
ping2010:
哥们最后如何解决的?
neo4j 未修改jdbc驱动中的连接用户名与密码错识 -
Gedo:
小菜求指点 ivy.xml里面怎么声明 能不说详细点 大 ...
ivy + ant+eclipse -
dongguang1082:
[color=red][/color][img][/]
条形码的工作原理和详细的内容 -
JadeLuo:
要将项目转化成Flex的项目类型才会自动生成
Flex4项目html-template文件夹解析 -
quentinyu777:
你好,我在创建Flex4SDK的Project为什么不生成ht ...
Flex4项目html-template文件夹解析
http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php
/************************************************************************************* * Copyright (c) 2004 Actuate Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Actuate Corporation - Initial implementation. ************************************************************************************/ package org.eclipse.birt.report.services; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.logging.Level; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.xml.namespace.QName; import org.apache.axis.AxisFault; import org.eclipse.birt.core.data.DataType; import org.eclipse.birt.core.data.DataTypeUtil; import org.eclipse.birt.core.exception.BirtException; import org.eclipse.birt.core.framework.IPlatformContext; import org.eclipse.birt.core.framework.PlatformServletContext; import org.eclipse.birt.data.engine.api.DataEngine; import org.eclipse.birt.data.engine.api.IResultMetaData; import org.eclipse.birt.report.engine.api.EngineConfig; import org.eclipse.birt.report.engine.api.EngineConstants; import org.eclipse.birt.report.engine.api.EngineException; import org.eclipse.birt.report.engine.api.HTMLActionHandler; import org.eclipse.birt.report.engine.api.HTMLEmitterConfig; import org.eclipse.birt.report.engine.api.HTMLRenderContext; import org.eclipse.birt.report.engine.api.HTMLRenderOption; import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; import org.eclipse.birt.report.engine.api.IDataExtractionTask; import org.eclipse.birt.report.engine.api.IDataIterator; import org.eclipse.birt.report.engine.api.IExtractionResults; import org.eclipse.birt.report.engine.api.IGetParameterDefinitionTask; import org.eclipse.birt.report.engine.api.IRenderTask; import org.eclipse.birt.report.engine.api.IReportDocument; import org.eclipse.birt.report.engine.api.IReportRunnable; import org.eclipse.birt.report.engine.api.IRunAndRenderTask; import org.eclipse.birt.report.engine.api.IRunTask; import org.eclipse.birt.report.engine.api.IScalarParameterDefn; import org.eclipse.birt.report.engine.api.PDFRenderContext; import org.eclipse.birt.report.engine.api.ReportEngine; import org.eclipse.birt.report.engine.api.ReportParameterConverter; import org.eclipse.birt.report.engine.api.impl.IResultSetItem; import org.eclipse.birt.report.engine.api.impl.ScalarParameterDefn; import org.eclipse.birt.report.engine.script.internal.ScriptExecutor; import org.eclipse.birt.report.model.api.ScalarParameterHandle; import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; import org.eclipse.birt.report.soapengine.IBirtConstants; import org.eclipse.birt.report.soapengine.api.Column; import org.eclipse.birt.report.soapengine.api.ResultSet; import org.eclipse.birt.report.viewer.utilities.ParameterAccessor; public class ReportEngineService { private static ReportEngineService instance; /** * Report engine instance. */ private ReportEngine engine = null; /** * Static engine config instance. */ private EngineConfig config = null; /** * Image directory for report images and charts. */ private String imageDirectory = null; /** * URL accesses images. */ private String imageBaseUrl = null; /** * Image handler instance. */ private HTMLServerImageHandler imageHandler = null; /** * Web app context path. */ private String contextPath = null; /** * Constructor. * * @param config */ public ReportEngineService( ServletConfig config ) { initEngineInstance( config ); ReportEngineService.instance = this; } /** * Get engine instance. * * @return */ synchronized public static ReportEngineService getInstance( ) { return instance; } /** * Get engine instance. * * @return engine instance */ synchronized private void initEngineInstance( ServletConfig servletConfig ) { System.setProperty( "RUN_UNDER_ECLIPSE", "false" ); //$NON-NLS-1$ //$NON-NLS-2$ if ( servletConfig == null ) { return; } config = new EngineConfig( ); // Register new image handler HTMLEmitterConfig emitterConfig = new HTMLEmitterConfig( ); emitterConfig.setActionHandler( new HTMLActionHandler( ) ); imageHandler = new HTMLServerImageHandler( ); emitterConfig.setImageHandler( imageHandler ); config.getEmitterConfigs( ).put( "html", emitterConfig ); //$NON-NLS-1$ // Prepare image directory. imageDirectory = servletConfig.getServletContext( ).getInitParameter( ParameterAccessor.INIT_PARAM_IMAGE_DIR ); if ( imageDirectory == null || imageDirectory.trim( ).length( ) <= 0 || ParameterAccessor.isRelativePath( imageDirectory ) ) { imageDirectory = servletConfig.getServletContext( ).getRealPath( "/report/images" ); //$NON-NLS-1$ } // Prepare image base url. imageBaseUrl = "/run?__imageID="; //$NON-NLS-1$ // Prepare log directory. String logDirectory = servletConfig.getServletContext( ).getInitParameter( ParameterAccessor.INIT_PARAM_LOG_DIR ); if ( logDirectory == null || logDirectory.trim( ).length( ) <= 0 || ParameterAccessor.isRelativePath( logDirectory ) ) { logDirectory = servletConfig.getServletContext( ).getRealPath( "/logs" ); //$NON-NLS-1$ } // Prepare log level. String logLevel = servletConfig.getServletContext( ).getInitParameter( ParameterAccessor.INIT_PARAM_LOG_LEVEL ); Level level = Level.OFF; if ( "SEVERE".equalsIgnoreCase( logLevel ) ) //$NON-NLS-1$ { level = Level.SEVERE; } else if ( "WARNING".equalsIgnoreCase( logLevel ) ) //$NON-NLS-1$ { level = Level.WARNING; } else if ( "INFO".equalsIgnoreCase( logLevel ) ) //$NON-NLS-1$ { level = Level.INFO; } else if ( "CONFIG".equalsIgnoreCase( logLevel ) ) //$NON-NLS-1$ { level = Level.CONFIG; } else if ( "FINE".equalsIgnoreCase( logLevel ) ) //$NON-NLS-1$ { level = Level.FINE; } else if ( "FINER".equalsIgnoreCase( logLevel ) ) //$NON-NLS-1$ { level = Level.FINER; } else if ( "FINEST".equalsIgnoreCase( logLevel ) ) //$NON-NLS-1$ { level = Level.FINEST; } else if ( "OFF".equalsIgnoreCase( logLevel ) ) //$NON-NLS-1$ { level = Level.OFF; } config.setLogConfig( logDirectory, level ); // Prepare ScriptLib location String scriptLibDir = servletConfig.getServletContext( ).getInitParameter( ParameterAccessor.INIT_PARAM_SCRIPTLIB_DIR ); if ( scriptLibDir == null || scriptLibDir.trim( ).length( ) <= 0 || ParameterAccessor.isRelativePath( scriptLibDir ) ) { scriptLibDir = servletConfig.getServletContext( ).getRealPath( "/scriptlib" ); //$NON-NLS-1$ } ArrayList jarFileList = new ArrayList(); if ( scriptLibDir != null ) { File dir = new File( scriptLibDir ); getAllJarFiles( dir, jarFileList ); } String scriptlibClassPath = ""; //$NON-NLS-1$ for ( int i=0; i<jarFileList.size(); i++ ) scriptlibClassPath += ScriptExecutor.PROPERTYSEPARATOR + ((File)jarFileList.get(i)).getAbsolutePath(); if ( scriptlibClassPath.startsWith(ScriptExecutor.PROPERTYSEPARATOR) ) scriptlibClassPath = scriptlibClassPath.substring( ScriptExecutor.PROPERTYSEPARATOR.length() ); System.setProperty( ScriptExecutor.WEBAPP_CLASSPATH_KEY, scriptlibClassPath ); } /** * Get all the files under the specified folder (including all the files under sub-folders) * @param dir - the folder to look into * @param fileList - the fileList to be returned */ private void getAllJarFiles( File dir, ArrayList fileList ) { if ( dir.exists() && dir.isDirectory() ) { File[] files = dir.listFiles(); if ( files == null ) return; for ( int i=0; i<files.length; i++ ) { File file = files[i]; if ( file.isFile() ) { if ( file.getName().endsWith(".jar") ) //$NON-NLS-1$ fileList.add( file ); } else if ( file.isDirectory() ) { getAllJarFiles( file, fileList ); } } } } /** * Set Engine context. * * @param servletContext * @param request */ synchronized public void setEngineContext( ServletContext servletContext, HttpServletRequest request ) { if ( engine == null ) { String url = request.getRequestURL( ).toString( ); this.contextPath = request.getContextPath( ); url = url.substring( 0, url.indexOf( contextPath, url.indexOf( "/" ) ) ) + contextPath; //$NON-NLS-1$ config.setEngineHome( "" ); //$NON-NLS-1$ IPlatformContext context = new PlatformServletContext( servletContext, url ); config.setEngineContext( context ); engine = new ReportEngine( config ); } } /** * Open report design. * * @param report * @return */ synchronized public IReportRunnable openReportDesign( String report ) throws EngineException { return engine.openReportDesign( report ); } /** * createGetParameterDefinitionTask. * * @param runnable * @return */ synchronized public IGetParameterDefinitionTask createGetParameterDefinitionTask( IReportRunnable runnable ) { IGetParameterDefinitionTask task = null; try { task = engine.createGetParameterDefinitionTask( runnable ); } catch ( Exception e ) { } return task; } /** * Open report document from archive, * * @param docName - the name of the report document * @return */ synchronized public IReportDocument openReportDocument( String docName ) { IReportDocument document = null; try { document = engine.openReportDocument( docName ); } catch ( Exception e ) { } return document; } /** * Render image. * * @param imageId * @param outputStream * @throws EngineException */ synchronized public void renderImage( String imageId, ServletOutputStream outputStream ) throws RemoteException { assert ( this.imageHandler != null ); try { this.imageHandler.getImage( outputStream, this.imageDirectory, imageId ); } catch ( EngineException e ) { AxisFault fault = new AxisFault( ); fault.setFaultCode( new QName( "ReportEngineService.renderImage( )" ) ); //$NON-NLS-1$ fault.setFaultString( e.getLocalizedMessage( ) ); throw fault; } } /** * Create HTML render context. * * @param svgFlag * @return */ synchronized private HTMLRenderContext createHTMLrenderContext( boolean svgFlag ) { HTMLRenderContext renderContext = new HTMLRenderContext( ); renderContext.setImageDirectory( imageDirectory ); renderContext.setBaseImageURL( contextPath + imageBaseUrl ); renderContext.setBaseURL( this.contextPath + "/frameset" ); //$NON-NLS-1$ renderContext.setSupportedImageFormats( svgFlag ? "PNG;GIF;JPG;BMP;SVG" : "PNG;GIF;JPG;BMP" ); //$NON-NLS-1$ //$NON-NLS-2$ return renderContext; } /** * Create PDF render context. * * @return */ synchronized private PDFRenderContext createPDFrenderContext( ) { PDFRenderContext renderContext = new PDFRenderContext( ); renderContext.setBaseURL( this.contextPath + "/frameset" ); //$NON-NLS-1$ renderContext.setSupportedImageFormats( "PNG;GIF;JPG;BMP" ); //$NON-NLS-1$ return renderContext; } /** * Run and render a report, * * @param runnable * @param outputStream * @param format * @param locale * @param parameters * @param svgFlag * @throws IOException */ synchronized public void runAndRenderReport( HttpServletRequest request, IReportRunnable runnable, ServletOutputStream outputStream, String format, Locale locale, HashMap parameters, boolean masterPage, boolean svgFlag ) throws RemoteException { assert runnable != null; // Render options HTMLRenderOption option = new HTMLRenderOption( ); option.setOutputStream( outputStream ); option.setOutputFormat( format ); option.setMasterPageContent( masterPage ); IRunAndRenderTask runAndRenderTask = engine.createRunAndRenderTask( runnable ); runAndRenderTask.setLocale( locale ); runAndRenderTask.setParameterValues( parameters ); runAndRenderTask.setRenderOption( option ); HashMap context = new HashMap( ); context.put( DataEngine.DATASET_CACHE_OPTION, Boolean.TRUE ); context.put( EngineConstants.APPCONTEXT_BIRT_VIEWER_HTTPSERVET_REQUEST, request ); context.put( EngineConstants.APPCONTEXT_CLASSLOADER_KEY, ReportEngineService.class.getClassLoader()); if ( !ParameterAccessor.PARAM_FORMAT_PDF.equalsIgnoreCase( format ) ) { context.put( EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, createHTMLrenderContext( svgFlag ) ); } else { context.put( EngineConstants.APPCONTEXT_PDF_RENDER_CONTEXT, createPDFrenderContext( ) ); } runAndRenderTask.setAppContext( context ); try { runAndRenderTask.run( ); } catch ( BirtException e ) { AxisFault fault = new AxisFault( ); fault.setFaultCode( new QName( "ReportEngineService.runAndRenderReport( )" ) ); //$NON-NLS-1$ fault.setFaultString( e.getLocalizedMessage( ) ); throw fault; } finally { runAndRenderTask.close( ); } } /** * Run report. * * @param runnable * @param archive * @param documentName * @param locale * @param parameters * @throws RemoteException */ synchronized public void runReport( HttpServletRequest request, IReportRunnable runnable, String documentName, Locale locale, HashMap parameters ) throws RemoteException { assert runnable != null; // Preapre the run report task. IRunTask runTask = engine.createRunTask( runnable ); runTask.setLocale( locale ); runTask.setParameterValues( parameters ); HashMap context = new HashMap( ); context.put( DataEngine.DATASET_CACHE_OPTION, Boolean.TRUE ); context.put( EngineConstants.APPCONTEXT_BIRT_VIEWER_HTTPSERVET_REQUEST, request ); context.put( EngineConstants.APPCONTEXT_CLASSLOADER_KEY, ReportEngineService.class.getClassLoader()); runTask.setAppContext( context ); // Run report. try { runTask.run( documentName ); } catch ( BirtException e ) { // Any Birt exception. AxisFault fault = new AxisFault( ); fault.setFaultCode( new QName( "ReportEngineService.runReport( )" ) ); //$NON-NLS-1$ fault.setFaultString( e.getLocalizedMessage( ) ); throw fault; } finally { runTask.close( ); } } /** * Render report page. * * @param reportDocument * @param pageNumber * @param svgFlag * @return report page content * @throws RemoteException */ synchronized public ByteArrayOutputStream renderReport( HttpServletRequest request, IReportDocument reportDocument, long pageNumber, boolean masterPage, boolean svgFlag, List activeIds, Locale locale ) throws RemoteException { assert reportDocument != null; assert pageNumber > 0 && pageNumber < reportDocument.getPageCount( ); ByteArrayOutputStream out = new ByteArrayOutputStream( ); // Create render task. IRenderTask renderTask = engine.createRenderTask( reportDocument ); HashMap context = new HashMap( ); context.put( EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, createHTMLrenderContext( svgFlag ) ); context.put( EngineConstants.APPCONTEXT_BIRT_VIEWER_HTTPSERVET_REQUEST, request ); context.put( EngineConstants.APPCONTEXT_CLASSLOADER_KEY, ReportEngineService.class.getClassLoader()); renderTask.setAppContext( context ); // Render option HTMLRenderOption setting = new HTMLRenderOption( ); setting.setOutputStream( out ); setting.setOutputFormat( IBirtConstants.RENDERFORMAT ); setting.setEmbeddable( true ); setting.setInstanceIDs( activeIds ); setting.setMasterPageContent( masterPage ); setting.setActionHandle( new ViewerHTMLActionHandler( reportDocument, pageNumber) ); renderTask.setRenderOption( setting ); renderTask.setLocale( locale ); // Render designated page. try { renderTask.render( pageNumber ); } catch ( BirtException e ) { AxisFault fault = new AxisFault( ); fault.setFaultCode( new QName( "ReportEngineService.renderReport( )" ) ); //$NON-NLS-1$ fault.setFaultString( e.getLocalizedMessage( ) ); throw fault; } catch ( Exception e ) { AxisFault fault = new AxisFault( ); fault.setFaultCode( new QName( "ReportEngineService.renderReport( )" ) ); //$NON-NLS-1$ fault.setFaultString( e.getLocalizedMessage( ) ); throw fault; } finally { renderTask.close( ); } return out; } /** * Get query result sets. * * @param document * @return * @throws RemoteException */ synchronized public ResultSet[] getResultSets( IReportDocument document ) throws RemoteException { assert document != null; ResultSet[] resultSetArray = null; IDataExtractionTask dataTask = engine.createDataExtractionTask( document ); try { List resultSets = dataTask.getResultSetList( ); if ( resultSets != null && resultSets.size( ) > 0 ) { resultSetArray = new ResultSet[resultSets.size( )]; for ( int k = 0; k < resultSets.size( ); k++ ) { resultSetArray[k] = new ResultSet( ); IResultSetItem resultSetItem = ( IResultSetItem ) resultSets.get( k ); assert resultSetItem != null; resultSetArray[k].setQueryName( resultSetItem.getResultSetName( ) ); IResultMetaData metaData = resultSetItem.getResultMetaData( ); assert metaData != null; Column[] columnArray = new Column[metaData.getColumnCount( )]; for ( int i = 0; i < metaData.getColumnCount( ); i++ ) { columnArray[i] = new Column( ); String name = metaData.getColumnName( i ); columnArray[i].setName( name ); String label = metaData.getColumnLabel( i ); if ( label == null || label.length( ) <= 0 ) { label = name; } columnArray[i].setLabel( label ); columnArray[i].setVisibility( new Boolean( true ) ); } resultSetArray[k].setColumn( columnArray ); } } } catch ( BirtException e ) { AxisFault fault = new AxisFault( ); fault.setFaultCode( new QName( "ReportEngineService.getMetaData( )" ) ); //$NON-NLS-1$ fault.setFaultString( e.getLocalizedMessage( ) ); throw fault; } catch ( Exception e ) { AxisFault fault = new AxisFault( ); fault.setFaultCode( new QName( "ReportEngineService.getMetaData( )" ) ); //$NON-NLS-1$ fault.setFaultString( e.getLocalizedMessage( ) ); throw fault; } finally { dataTask.close( ); } return resultSetArray; } /** * Extract data. * * @param document * @param id * @param columns * @param filters * @param locale * @param outputStream * @throws RemoteException */ synchronized public void extractData( IReportDocument document, String resultSetName, Collection columns, Locale locale, ServletOutputStream outputStream ) throws RemoteException { assert document != null; assert resultSetName != null && resultSetName.length( ) > 0; assert columns != null && !columns.isEmpty( ); String[] columnNames = new String[columns.size( )]; Iterator iSelectedColumns = columns.iterator( ); for ( int i = 0; iSelectedColumns.hasNext( ); i++ ) { columnNames[i] = ( String ) iSelectedColumns.next( ); } IDataExtractionTask dataTask = null; IExtractionResults result = null; IDataIterator iData = null; try { dataTask = engine.createDataExtractionTask( document ); dataTask.selectResultSet( resultSetName ); dataTask.selectColumns( columnNames ); dataTask.setLocale( locale ); result = dataTask.extract( ); if ( result != null ) { IResultMetaData iMetaData = result.getResultMetaData( ); iData = result.nextResultIterator( ); if ( iData != null && iMetaData != null ) { StringBuffer buf = new StringBuffer( ); // Captions String caption = iMetaData.getColumnLabel( 0 ); if ( caption != null ) { buf.append( caption ); } else { buf.append( iMetaData.getColumnName( 0 ) ); } for ( int i = 1; i < columnNames.length; i++ ) { buf.append( ',' ); //$NON-NLS-1$ caption = iMetaData.getColumnLabel( i ); if ( caption != null ) { buf.append( caption ); } else { buf.append( iMetaData.getColumnName( i ) ); } } outputStream.println( buf.toString( ) ); buf.delete( 0, buf.length( ) ); // Data while ( iData.next( ) ) { String value = null; try { value = cvsConvertor( ( String ) DataTypeUtil .convert( iData.getValue( columnNames[0] ), DataType.STRING_TYPE ) ); } catch ( Exception e ) { value = null; } if ( value != null ) { buf.append( value ); } for ( int i = 1; i < columnNames.length; i++ ) { buf.append( ',' ); //$NON-NLS-1$ try { value = cvsConvertor( ( String ) DataTypeUtil .convert( iData.getValue( columnNames[i] ), DataType.STRING_TYPE ) ); } catch ( Exception e ) { value = null; } if ( value != null ) { buf.append( value ); } } outputStream.println( buf.toString( ) ); buf.delete( 0, buf.length( ) ); } } } } catch( Exception e ) { AxisFault fault = new AxisFault( ); fault.setFaultCode( new QName( "ReportEngineService.extractData( )" ) ); //$NON-NLS-1$ fault.setFaultString( e.getLocalizedMessage( ) ); throw fault; } finally { if ( iData != null ) { iData.close( ); } if ( result != null ) { result.close( ); } if ( dataTask != null ) { dataTask.close( ); } } } /** * CSV format convertor. Here is the rule. * * 1) Fields with embedded commas must be delimited with double-quote characters. * 2) Fields that contain double quote characters must be surounded by double-quotes, and * the embedded double-quotes must each be represented by a pair of consecutive double quotes. * 3) A field that contains embedded line-breaks must be surounded by double-quotes. * 4) Fields with leading or trailing spaces must be delimited with double-quote characters. * * @param value * @return * @throws RemoteException */ synchronized private String cvsConvertor( String value ) throws RemoteException { if ( value == null ) { return null; } value = value.replaceAll( "\"", "\"\"" ); //$NON-NLS-1$ //$NON-NLS-2$ boolean needQuote = false; needQuote = ( value.indexOf( ',' ) != -1 ) || ( value.indexOf( '"' ) != -1 ) //$NON-NLS-1$ //$NON-NLS-2$ || ( value.indexOf( 0x0A ) != -1 ) || value.startsWith( " " ) || value.endsWith( " " ); //$NON-NLS-1$ //$NON-NLS-2$ value = needQuote ? "\"" + value + "\"" : value; //$NON-NLS-1$ //$NON-NLS-2$ return value; } /** * Prepare the report parameters. * * @param request * @param task * @param configVars * @param locale * @return */ synchronized public HashMap parseParameters( HttpServletRequest request, IGetParameterDefinitionTask task, Map configVars, Locale locale ) { assert task != null; HashMap params = new HashMap( ); Collection parameterList = task.getParameterDefns( false ); for ( Iterator iter = parameterList.iterator( ); iter.hasNext( ); ) { ScalarParameterDefn parameterObj = ( ScalarParameterDefn ) iter.next( ); String paramValue = null; Object paramValueObj = null; ScalarParameterHandle paramHandle = (ScalarParameterHandle) parameterObj.getHandle( ); String paramName = paramHandle.getName( ); String format = paramHandle.getFormat( ); // Get default value from task ReportParameterConverter converter = new ReportParameterConverter( format, locale ); if ( ParameterAccessor.isReportParameterExist( request, paramName ) ) { // Get value from http request paramValue = ParameterAccessor.getReportParameter( request, paramName, paramValue ); paramValueObj = converter.parse( paramValue, getEngineDataType( paramHandle.getDataType( ) ) ); } else if ( ParameterAccessor.isDesigner( request ) && configVars.containsKey( paramName ) ) { // Get value from test config String configValue = (String) configVars.get( paramName ); ReportParameterConverter cfgConverter = new ReportParameterConverter( format, Locale.US ); paramValueObj = cfgConverter.parse( configValue, getEngineDataType( paramHandle.getDataType( ) ) ); } else { paramValueObj = task.getDefaultValue( paramHandle.getName( ) ); } params.put( paramName, paramValueObj ); } return params; } /** * Check whether missing parameter or not. * * @param task * @param parameters * @return */ synchronized public boolean validateParameters( IGetParameterDefinitionTask task, Map parameters ) { assert task != null; assert parameters != null; boolean missingParameter = false; Collection parameterList = task.getParameterDefns( false ); for ( Iterator iter = parameterList.iterator( ); iter.hasNext( ); ) { ScalarParameterDefn parameterObj = ( ScalarParameterDefn ) iter.next( ); ScalarParameterHandle paramHandle = (ScalarParameterHandle) parameterObj.getHandle( ); String parameterName = paramHandle.getName( ); Object parameterValue = parameters.get( parameterName ); if ( paramHandle.isHidden( ) ) { continue; } if ( parameterValue == null && !paramHandle.allowNull( ) ) { missingParameter = true; break; } if ( DesignChoiceConstants.PARAM_TYPE_STRING.equals( paramHandle.getDataType( ) ) ) { String parameterStringValue = ( String ) parameterValue; if ( parameterStringValue != null && parameterStringValue.length( ) <= 0 && !paramHandle.allowBlank( ) ) { missingParameter = true; break; } } } return missingParameter; } /** * Parameter typer convertion. * * @param type * @return */ synchronized public int getEngineDataType( String type ) { if ( DesignChoiceConstants.PARAM_TYPE_BOOLEAN.equals( type ) ) { return IScalarParameterDefn.TYPE_BOOLEAN; } else if ( DesignChoiceConstants.PARAM_TYPE_DATETIME.equals( type ) ) { return IScalarParameterDefn.TYPE_DATE_TIME; } else if ( DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals( type ) ) { return IScalarParameterDefn.TYPE_DECIMAL; } else if ( DesignChoiceConstants.PARAM_TYPE_FLOAT.equals( type ) ) { return IScalarParameterDefn.TYPE_FLOAT; } else if ( DesignChoiceConstants.PARAM_TYPE_STRING.equals( type ) ) { return IScalarParameterDefn.TYPE_STRING; } return IScalarParameterDefn.TYPE_ANY; } }
发表评论
-
birt 集成日期及其它控件
2011-06-20 13:08 444http://blog.csdn.net/kj_zx19854 ... -
birt 脚本数据源
2011-06-14 16:34 1754<property name=& ... -
Birt的JavaScript脚本简单调试
2011-06-03 09:09 2575Birt的JavaScript脚本简单调试 B ... -
Understanding the CVS Structure
2011-05-25 14:29 1057Understanding the CVS Structure ... -
birt 参考网址
2011-05-25 09:28 751http://my.oschina.net/kzhou/blo ... -
BirtViewer和Struts2框架的整合
2011-05-24 16:34 798BirtViewer和Struts2框架的整合 http ... -
birt国际化及已重编译的包
2011-05-19 08:17 1475BIRT的CVS访问地址 host:dev.eclipse. ... -
birt脚本的运行次序
2011-04-28 14:23 911Layout->initializeLayout-> ... -
使用birt脚本注意要点
2011-04-28 12:10 984When developing a BIRT report u ...
相关推荐
通过`ReportEngineService`,可以在Java EE环境中提供报表服务,用户可以通过HTTP请求获取报表。另外,也可以通过`ReportAppServlet`在独立的Web应用中部署BIRT报表服务器。 6. **实例分析**:压缩包中的"birt报表...
大华无插件播放项目111
内容概要:本文详细介绍了Oracle 19c数据库的备份恢复和导入导出操作。首先概述了基本命令,然后分别讲述了三种工作方式(交互式、命令行、参数文件)和三种模式(表、用户、全库)。接着介绍了高级选项,如分割成多个文件、增量导出/导入、以SYSDBA进行导出/导入、表空间传输等。最后讨论了优化技巧,包括加快导出和导入速度的方法。还解决了一些常见问题,如字符集问题和版本问题。 适用人群:Oracle数据库管理员和相关技术人员。 使用场景及目标:适合在日常数据库管理和维护中进行数据备份、恢复、导入和导出操作,提高数据安全性和管理效率。 其他说明:文章内容丰富,涉及多种实用技巧,适用于不同场景下的具体操作,有助于提升工作效率。
基于Python Flask开发的旅游酒店大数据可视化项目,可以直接运行。 操作步骤: 1. 解压缩项目文件 2. 使用 pycharm打开项目 3. 运行项目中的app.py文件 注意:需要确保项目的Flask Python相关的环境已经搭建完成。
Android 毕业设计,Android 毕业设计,小Android 程设计,含有代码注释,新手也可看懂。毕业设计、期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。 包含:项目源码、数据库脚本、软件工具等,该项目可以作为毕设、课程设计使用,前后端代码都在里面。 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。
Android 毕业设计,Android 毕业设计,小Android 程设计,含有代码注释,新手也可看懂。毕业设计、期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。 包含:项目源码、数据库脚本、软件工具等,该项目可以作为毕设、课程设计使用,前后端代码都在里面。 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。
基于stm32和openmv的电赛校赛自动泊车题目源码+文档设计报告,个人高分设计项目、经导师指导并认可通过的高分设计项目,评审分99分,代码完整确保可以运行,小白也可以亲自搞定,主要针对计算机相关专业的学生和需要项目实战练习的学习者。 基于stm32和openmv的电赛校赛自动泊车题目源码+文档设计报告基于stm32和openmv的电赛校赛自动泊车题目源码+文档设计报告基于stm32和openmv的电赛校赛自动泊车题目源码+文档设计报告基于stm32和openmv的电赛校赛自动泊车题目源码+文档设计报告基于stm32和openmv的电赛校赛自动泊车题目源码+文档设计报告基于stm32和openmv的电赛校赛自动泊车题目源码+文档设计报告基于stm32和openmv的电赛校赛自动泊车题目源码+文档设计报告基于stm32和openmv的电赛校赛自动泊车题目源码+文档设计报告个人高分设计项目、经导师指导并认可通过的高分设计项目,评审分99分,代码完整确保可以运行,小白也可以亲自搞定,主要针对计算机相关专业的学生和需要项目实战练习的学习者。 个人高分设计项目、经导师指导并认可通过的高分设
棉花检测20-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord、VOC数据集合集.rar棉-V2释放 ============================= *与您的团队在计算机视觉项目上合作 *收集和组织图像 *了解非结构化图像数据 *注释,创建数据集 *导出,训练和部署计算机视觉模型 *使用主动学习随着时间的推移改善数据集 它包括406张图像。 以可可格式注释棉花。 将以下预处理应用于每个图像: 没有应用图像增强技术。
项目包含前后台完整源码。 项目都经过严格调试,确保可以运行! 具体项目介绍可查看博主文章或私聊获取 助力学习实践,提升编程技能,快来获取这份宝贵的资源吧!
windwos环境下python 3.11系列64位安装包,仅推荐个人学习、开发、娱乐或者测试环境下使用。
使用精品酒销售管理系统的用户分管理员和用户两个角色的权限子模块。 管理员所能使用的功能主要有:主页、个人中心、用户管理、商品分类管理、商品信息管理、系统管理、订单管理等。 用户可以实现主页、个人中心、我的收藏管理、订单管理等。 前台首页可以实现商品信息、新闻资讯、我的、跳转到后台、购物车等。 项目包含完整前后端源码和数据库文件 环境说明: 开发语言:Java 框架:ssm,mybatis JDK版本:JDK1.8 数据库:mysql 5.7 数据库工具:Navicat11 开发软件:eclipse/idea Maven包:Maven3.3 服务器:tomcat7
Video_2024-12-18_000023.wmv
ppt最終版asasaadd
计算机图形学期末考试
springboot-基于SpringBootVue的家具商城系统设计与实现.zip
PenTablet_5.2.4-5.zip
考虑了企业管理者的实际工作环境和需求,最终将人力资源系统划分为5个部分,即登录模块、组织发展模块、员工团队模块、合同管理模块、党建管理模块。 环境说明: 开发语言:Java 框架:ssm,mybatis JDK版本:JDK1.8 数据库:mysql 5.7 数据库工具:Navicat11 开发软件:eclipse/idea Maven包:Maven3.3 服务器:tomcat7
QT音乐播放器MP3 可点击播放可上一首下一首可调节音量 可暂停可上传音乐
椅子检测6-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord、VOC数据集合集.rar对象检测实验室-V1 2023-08-21 2:28 PM ============================= *与您的团队在计算机视觉项目上合作 *收集和组织图像 *了解和搜索非结构化图像数据 *注释,创建数据集 *导出,训练和部署计算机视觉模型 *使用主动学习随着时间的推移改善数据集 对于最先进的计算机视觉培训笔记本,您可以与此数据集一起使用 该数据集包括997张图像。 对象以可可格式注释。 将以下预处理应用于每个图像: *像素数据的自动取向(带有Exif-Arientation剥离) *调整大小为640x640(拉伸) 应用以下扩展来创建每个源图像的3个版本: *将盐和胡椒噪声应用于10%的像素
Python课程设计,含有代码注释,新手也可看懂。毕业设计、期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。 包含:项目源码、数据库脚本、软件工具等,该项目可以作为毕设、课程设计使用,前后端代码都在里面。 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。