- 浏览: 428265 次
- 性别:
- 来自: 珠海
文章分类
- 全部博客 (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 450http://blog.csdn.net/kj_zx19854 ... -
birt 脚本数据源
2011-06-14 16:34 1760<property name=& ... -
Birt的JavaScript脚本简单调试
2011-06-03 09:09 2578Birt的JavaScript脚本简单调试 B ... -
Understanding the CVS Structure
2011-05-25 14:29 1061Understanding the CVS Structure ... -
birt 参考网址
2011-05-25 09:28 758http://my.oschina.net/kzhou/blo ... -
BirtViewer和Struts2框架的整合
2011-05-24 16:34 801BirtViewer和Struts2框架的整合 http ... -
birt国际化及已重编译的包
2011-05-19 08:17 1477BIRT的CVS访问地址 host:dev.eclipse. ... -
birt脚本的运行次序
2011-04-28 14:23 918Layout->initializeLayout-> ... -
使用birt脚本注意要点
2011-04-28 12:10 992When developing a BIRT report u ...
相关推荐
通过`ReportEngineService`,可以在Java EE环境中提供报表服务,用户可以通过HTTP请求获取报表。另外,也可以通过`ReportAppServlet`在独立的Web应用中部署BIRT报表服务器。 6. **实例分析**:压缩包中的"birt报表...
globalmousekeyhook InputSimulator
免费JAVA毕业设计 2024成品源码+论文+录屏+启动教程 启动教程:https://www.bilibili.com/video/BV1SzbFe7EGZ 项目讲解视频:https://www.bilibili.com/video/BV1Tb421n72S 二次开发教程:https://www.bilibili.com/video/BV18i421i7Dx
基于麻雀搜索算法优化SVR回归预测模型:以身体脂肪含量数据集的精准预测为研究对象,基于麻雀搜索算法优化SVR回归预测模型 输入不限,单输出 数据选用:身体脂肪含量数据集 针对SVR回归预测模型采用麻雀搜索算法 ,基于麻雀搜索算法; SVR回归预测模型优化; 身体脂肪含量数据集; 算法优化SVR模型,基于麻雀搜索算法优化SVR预测身体脂肪含量模型
1、文件内容:perl-Net-DNS-Nameserver-0.72-6.el7.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/perl-Net-DNS-Nameserver-0.72-6.el7.tar.gz #Step2、进入解压后的目录,执行安装 sudo rpm -ivh *.rpm 4、安装指导:私信博主,全程指导安装
1、文件内容:perl-Class-Singleton-1.4-14.el7.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/perl-Class-Singleton-1.4-14.el7.tar.gz #Step2、进入解压后的目录,执行安装 sudo rpm -ivh *.rpm 4、安装指导:私信博主,全程指导安装
C++-example-数组奇偶数分离.rar
免费JAVA毕业设计 2024成品源码+论文+录屏+启动教程 启动教程:https://www.bilibili.com/video/BV1SzbFe7EGZ 项目讲解视频:https://www.bilibili.com/video/BV1Tb421n72S 二次开发教程:https://www.bilibili.com/video/BV18i421i7Dx
JAVA**
免费JAVA毕业设计 2024成品源码+论文+录屏+启动教程 启动教程:https://www.bilibili.com/video/BV1SzbFe7EGZ 项目讲解视频:https://www.bilibili.com/video/BV1Tb421n72S 二次开发教程:https://www.bilibili.com/video/BV18i421i7Dx
自然语言处理导论+网络预览版(张奇)
一个使用 C++ 结合 DeepSeek 相关功能的源码,模拟一个简单的问答场景,使用 DeepSeek 模型来回答用户提出的问题。 实现思路 模型和分词器加载:利用 libtorch 加载 DeepSeek 模型,使用 tokenizers-cpp 加载对应的分词器。 问题处理:对用户输入的问题进行分词和编码,转化为模型可处理的张量形式。 模型推理:将编码后的问题输入到模型中进行推理,获取预测结果。 结果解码:把模型输出的结果解码为可读的文本。 环境准备 安装 PyTorch C++ 库(libtorch):从 PyTorch 官方网站 下载适合你系统的预编译版本。 安装 tokenizers-cpp:可以从其 GitHub 仓库 获取并编译安装。
,三菱FX3U ST语言程序模板 1 程序采用三菱FX3U的PLC编写。 2 触摸屏是台达 3 程序由以下部分组成 3.1 开机准备 3.2 复位 3.3 加热控制 3.4 暂停控制 3.5自动运行 3.6 生产管理 3.7节控制 3.8自动紧急停止 3.9 手动程序 3.10 手动复位 3.11 程序输出 3.12 气缸报警 3.13 密码管理 3.14 辅助控制 如果你是初学者,不建议去看。 如果你有一定的经验,可以更一步的提高技术。 为以后做运控控制卡,运动控制器做好基础。 是一个很不错的程序。
免费JAVA毕业设计 2024成品源码+论文+录屏+启动教程 启动教程:https://www.bilibili.com/video/BV1SzbFe7EGZ 项目讲解视频:https://www.bilibili.com/video/BV1Tb421n72S 二次开发教程:https://www.bilibili.com/video/BV18i421i7Dx
1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
JavaEE
1、文件内容:perl-Module-Implementation-0.06-6.el7.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/perl-Module-Implementation-0.06-6.el7.tar.gz #Step2、进入解压后的目录,执行安装 sudo rpm -ivh *.rpm 4、安装指导:私信博主,全程指导安装
1、文件内容:perl-Image-Xbm-1.08-21.el7.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/perl-Image-Xbm-1.08-21.el7.tar.gz #Step2、进入解压后的目录,执行安装 sudo rpm -ivh *.rpm 4、安装指导:私信博主,全程指导安装
1、文件内容:perl-HTTP-Date-6.02-8.el7.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/perl-HTTP-Date-6.02-8.el7.tar.gz #Step2、进入解压后的目录,执行安装 sudo rpm -ivh *.rpm 4、安装指导:私信博主,全程指导安装
基于FPGA技术的HDMI视频输出实现策略与应用案例分析,基于fpga实现hdmi视频输出的实现 ,基于FPGA; 实现HDMI; 视频输出; 关键技术; 视频处理; 信号转换; 驱动开发,基于FPGA的HDMI视频输出实现技术