You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2009/12/02 10:36:00 UTC

svn commit: r886087 - in /ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report: context/BirtViewerAttributeBean.java context/OFBizBirtContext.java servlet/BirtEngineServlet.java servlet/BirtViewerServlet.java

Author: hansbak
Date: Wed Dec  2 09:35:59 2009
New Revision: 886087

URL: http://svn.apache.org/viewvc?rev=886087&view=rev
Log:
offending EPL java code removed, is now extending the EPL licensed java class and not copying it. also removed code that was required to make the Birt viewer work, which is now not required anymore.

Modified:
    ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java
    ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java
    ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java
    ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java

Modified: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java?rev=886087&r1=886086&r2=886087&view=diff
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java (original)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java Wed Dec  2 09:35:59 2009
@@ -36,85 +36,13 @@
 public class BirtViewerAttributeBean extends ViewerAttributeBean {
     
     public final static String module = BirtViewerAttributeBean.class.getName();
-    
-    /**
-     * Module Options
-     */
-    private Map moduleOptions = null;
-    
-    /**
-     * Request Type
-     */
-    private String requestType;
-    
-    private Boolean reportRtl;
 
-    public BirtViewerAttributeBean(HttpServletRequest arg0) {
-        super(arg0);
-        // TODO Auto-generated constructor stub
+    public BirtViewerAttributeBean(HttpServletRequest request) {
+        super(request);
     }
     
-    /**
-     * Init the bean.
-     * 
-     * @param request
-     * @throws Exception
-     */
     protected void __init( HttpServletRequest request ) throws Exception
     {
-        // If GetImage operate, return directly.
-        if ( ParameterAccessor.isGetImageOperator( request )
-                && ( IBirtConstants.SERVLET_PATH_FRAMESET
-                        .equalsIgnoreCase( request.getServletPath( ) )
-                        || IBirtConstants.SERVLET_PATH_OUTPUT
-                                .equalsIgnoreCase( request.getServletPath( ) )
-                        || IBirtConstants.SERVLET_PATH_RUN
-                                .equalsIgnoreCase( request.getServletPath( ) ) || IBirtConstants.SERVLET_PATH_PREVIEW
-                        .equalsIgnoreCase( request.getServletPath( ) ) ) )
-        {
-            return;
-        }
-
-        this.category = "BIRT"; //$NON-NLS-1$
-        this.masterPageContent = ParameterAccessor
-                .isMasterPageContent( request );
-        this.isDesigner = ParameterAccessor.isDesigner( );
-        
-        if ( !ParameterAccessor.isBookmarkReportlet( request ) )
-        {
-            this.bookmark = ParameterAccessor.getBookmark( request );
-        }
-        else
-        {
-            this.bookmark = null;
-        }        
-        
-        this.isToc = ParameterAccessor.isToc( request );
-        this.reportPage = ParameterAccessor.getPage( request );
-        this.reportPageRange = ParameterAccessor.getPageRange( request );
-        this.action = ParameterAccessor.getAction( request );
-
-        // If use frameset/output/download/extract servlet pattern, generate
-        // document
-        // from design file
-        if ( IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase( request
-                .getServletPath( ) )
-                || IBirtConstants.SERVLET_PATH_OUTPUT.equalsIgnoreCase( request
-                        .getServletPath( ) )
-                || IBirtConstants.SERVLET_PATH_DOWNLOAD
-                        .equalsIgnoreCase( request.getServletPath( ) )
-                || IBirtConstants.SERVLET_PATH_EXTRACT
-                        .equalsIgnoreCase( request.getServletPath( ) ) )
-        {
-            this.reportDocumentName = ParameterAccessor.getReportDocument(
-                    request, null, true );
-        }
-        else
-        {
-            this.reportDocumentName = ParameterAccessor.getReportDocument(
-                    request, null, false );
-        }
-
         String reportParam = DataUtil.trimString( ParameterAccessor.getParameter( request, ParameterAccessor.PARAM_REPORT ));
         if (reportParam.startsWith("component://")) {
             ClassLoader loader = Thread.currentThread().getContextClassLoader();
@@ -131,56 +59,10 @@
             this.reportDesignName = ParameterAccessor.getReport( request, null );
         }
 
-        this.emitterId = ParameterAccessor.getEmitterId( request );
-        
-        // If print action, force to use postscript format
-        this.format = ParameterAccessor.getFormat( request );
-        if ( IBirtConstants.ACTION_PRINT.equalsIgnoreCase( action ) )
-        {
-            // Check whether turn on this funtion
-            if ( ParameterAccessor.isSupportedPrintOnServer )
-            {
-                this.format = IBirtConstants.POSTSCRIPT_RENDER_FORMAT;
-                this.emitterId = null;
-            }
-            else
-            {
-                this.action = null;
-            }
-        }
-
-        // Set locale information
-        BirtResources.setLocale( ParameterAccessor.getLocale( request ) );
-
-        // Set the request type
-        this.requestType = request
-                .getHeader( ParameterAccessor.HEADER_REQUEST_TYPE );
-
-        // Determine the report design and doc 's timestamp
-        processReport( request );
-
-        // Report title.
-        this.reportTitle = ParameterAccessor.getTitle( request );
-
-        // Set whether show the report title
-        this.isShowTitle = ParameterAccessor.isShowTitle( request );
-
-        // Set whether show the toolbar
-        this.isShowToolbar = ParameterAccessor.isShowToolbar( request );
-
-        // Set whether show the navigation bar
-        this.isShowNavigationbar = ParameterAccessor
-                .isShowNavigationbar( request );
-
-        // get some module options
-        this.moduleOptions = BirtUtility.getModuleOptions( request );
-
         this.reportDesignHandle = getDesignHandle( request );
         if ( this.reportDesignHandle == null )
             throw new ViewerException(
                     ResourceConstants.GENERAL_EXCEPTION_NO_REPORT_DESIGN );
-
-        this.reportRtl = null;
         
         // Initialize report parameters.
         __initParameters( request );

Modified: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java?rev=886087&r1=886086&r2=886087&view=diff
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java (original)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java Wed Dec  2 09:35:59 2009
@@ -26,15 +26,15 @@
 import org.eclipse.birt.report.context.ViewerAttributeBean;
 
 public class OFBizBirtContext extends BirtContext {
+    
+    public final static String module = OFBizBirtContext.class.getName();
 
     public OFBizBirtContext(HttpServletRequest request,
             HttpServletResponse response) {
         super(request, response);
-        // TODO Auto-generated constructor stub
     }
 
     protected void __init() {
-        // TODO Auto-generated method stub
         this.bean = (ViewerAttributeBean) request
                 .getAttribute( IBirtConstants.ATTRIBUTE_BEAN );
         if ( bean == null )

Modified: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java?rev=886087&r1=886086&r2=886087&view=diff
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java (original)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java Wed Dec  2 09:35:59 2009
@@ -37,17 +37,10 @@
 import org.ofbiz.birt.report.context.OFBizBirtContext;
 import org.ofbiz.birt.report.service.OFBizBirtViewerReportService;
 
-public class BirtEngineServlet extends BaseReportEngineServlet {
-    /**
-     * TODO: what's this?
-     */
-    private static final long serialVersionUID = 1L;
+public class BirtEngineServlet extends org.eclipse.birt.report.servlet.BirtEngineServlet {
+    
+    public final static String module = BirtEngineServlet.class.getName();
 
-    /**
-     * Local initialization.
-     * 
-     * @return
-     */
     protected void __init( ServletConfig config )
     {
         BirtReportServiceFactory.init( new OFBizBirtViewerReportService( config
@@ -57,19 +50,9 @@
 
         requester = new RequesterFragment( );
         requester.buildComposite( );
-        requester.setJSPRootPath( "/webcontent/birt" ); //$NON-NLS-1$
+        requester.setJSPRootPath( "/webcontent/birt" );
     }
 
-    /**
-     * Init context.
-     * 
-     * @param request
-     *            incoming http request
-     * @param response
-     *            http response
-     * @exception BirtException
-     * @return IContext
-     */
     protected IContext __getContext( HttpServletRequest request,
             HttpServletResponse response ) throws BirtException
     {
@@ -77,68 +60,4 @@
                 getServletContext( ), null );
         return new OFBizBirtContext( request, response );
     }
-
-    /**
-     * Local authentication.
-     * 
-     * @param request
-     *            incoming http request
-     * @param response
-     *            http response
-     * @return
-     */
-    protected boolean __authenticate( HttpServletRequest request,
-            HttpServletResponse response )
-    {
-        return true;
-    }
-
-    /**
-     * Local do get.
-     */
-    protected void __doGet( IContext context ) throws ServletException,
-            IOException, BirtException
-    {
-        ViewerAttributeBean bean = (ViewerAttributeBean) context.getBean( );
-        assert bean != null;
-
-        if ( ( IBirtConstants.SERVLET_PATH_PREVIEW.equalsIgnoreCase( context
-                .getRequest( ).getServletPath( ) )
-                || IBirtConstants.SERVLET_PATH_DOCUMENT
-                        .equalsIgnoreCase( context.getRequest( )
-                                .getServletPath( ) ) || IBirtConstants.SERVLET_PATH_OUTPUT
-                .equalsIgnoreCase( context.getRequest( ).getServletPath( ) ) )
-                && bean.isShowParameterPage( ) )
-        {
-            requester.service( context.getRequest( ), context.getResponse( ) );
-        }
-        else if ( IBirtConstants.SERVLET_PATH_PARAMETER
-                .equalsIgnoreCase( context.getRequest( ).getServletPath( ) ) )
-        {
-            requester.service( context.getRequest( ), context.getResponse( ) );
-        }
-        else
-        {
-            engine.service( context.getRequest( ), context.getResponse( ) );
-        }
-    }
-
-    /**
-     * Process exception for non soap request.
-     * 
-     * @param request
-     *            incoming http request
-     * @param response
-     *            http response
-     * @param exception
-     * @throws ServletException
-     * @throws IOException
-     */
-    protected void __handleNonSoapException( HttpServletRequest request,
-            HttpServletResponse response, Exception exception )
-            throws ServletException, IOException
-    {
-        exception.printStackTrace( );
-        BirtUtility.appendErrorMessage( response.getOutputStream( ), exception );
-    }
 }

Modified: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java?rev=886087&r1=886086&r2=886087&view=diff
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java (original)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java Wed Dec  2 09:35:59 2009
@@ -33,40 +33,30 @@
 import org.eclipse.birt.report.presentation.aggregation.layout.RunFragment;
 import org.eclipse.birt.report.service.BirtReportServiceFactory;
 import org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet;
+import org.eclipse.birt.report.servlet.ViewerServlet;
 import org.eclipse.birt.report.utility.BirtUtility;
 import org.ofbiz.birt.report.context.OFBizBirtContext;
 import org.ofbiz.birt.report.service.OFBizBirtViewerReportService;
 
-public class BirtViewerServlet extends BirtSoapMessageDispatcherServlet {
+public class BirtViewerServlet extends ViewerServlet {
     
     public final static String module = BirtViewerServlet.class.getName();
     
     protected void __init(ServletConfig config) {
-        // TODO Auto-generated method stub
         BirtReportServiceFactory.init( new OFBizBirtViewerReportService( config
                 .getServletContext( ) ) );
         
         // handle 'frameset' pattern
         viewer = new FramesetFragment( );
         viewer.buildComposite( );
-        viewer.setJSPRootPath( "/webcontent/birt" ); //$NON-NLS-1$
+        viewer.setJSPRootPath( "/webcontent/birt" );
 
         // handle 'run' pattern
         run = new RunFragment( );
         run.buildComposite( );
-        run.setJSPRootPath( "/webcontent/birt" ); //$NON-NLS-1$            
+        run.setJSPRootPath( "/webcontent/birt" );
     }
-    
-    /**
-     * Init context.
-     * 
-     * @param request
-     *            incoming http request
-     * @param response
-     *            http response
-     * @exception BirtException
-     * @return IContext
-     */
+
     protected IContext __getContext( HttpServletRequest request,
             HttpServletResponse response ) throws BirtException
     {
@@ -74,87 +64,4 @@
                 getServletContext( ), null );
         return new OFBizBirtContext( request, response );
     }
-    
-    /**
-     * Local process http request with GET method.
-     * 
-     * @param request
-     *            incoming http request
-     * @param response
-     *            http response
-     * @exception ServletException
-     * @exception IOException
-     * @return
-     */
-    protected void __doGet( IContext context ) throws ServletException,
-            IOException, BirtException
-    {
-        IFragment activeFragment = null;
-        String servletPath = context.getRequest( ).getServletPath( );
-        if ( IBirtConstants.SERVLET_PATH_FRAMESET
-                .equalsIgnoreCase( servletPath ) )
-        {
-            activeFragment = viewer;
-        }
-        else if ( IBirtConstants.SERVLET_PATH_RUN
-                .equalsIgnoreCase( servletPath ) )
-        {
-            activeFragment = run;
-        }
-
-        if ( activeFragment != null )
-            activeFragment.service( context.getRequest( ), context
-                    .getResponse( ) );
-    }
-    
-    /**
-     * Locale process http request with POST method. Four different servlet
-     * paths are expected: "/frameset", "/navigation", "/toolbar", and "/run".
-     * 
-     * @param request
-     *            incoming http request
-     * @param response
-     *            http response
-     * @exception ServletException
-     * @exception IOException
-     * @return
-     */
-    protected void __doPost( IContext context ) throws ServletException,
-            IOException, BirtException
-    {
-    }
-    
-    /**
-     * Local authentication. Alwasy returns true.
-     * 
-     * @param request
-     *            incoming http request
-     * @param response
-     *            http response
-     * @return
-     */
-    protected boolean __authenticate( HttpServletRequest request,
-            HttpServletResponse response )
-    {
-        return true;
-    }
-    
-    /**
-     * Process exception for non soap request.
-     * 
-     * @param request
-     *            incoming http request
-     * @param response
-     *            http response
-     * @param exception
-     * @throws ServletException
-     * @throws IOException
-     */
-    protected void __handleNonSoapException( HttpServletRequest request,
-            HttpServletResponse response, Exception exception )
-            throws ServletException, IOException
-    {
-        exception.printStackTrace( );
-        BirtUtility.appendErrorMessage( response.getOutputStream( ), exception );
-    }
 }