📄 reportserverbean.java
字号:
/**
* reportServer for JasperReport.
* Copyright (C) 2004 Peter Shen.
* Shanghai, China.
* Email: zpshen@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contributor: Marco LOMBARDO, Compilo subAdministrator.
* lombardo@mayking.com, mar9000@gmail.com
* Italy.
**/
package net.sf.compilo.session;
import java.rmi.RemoteException;
import java.util.Properties;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import org.compiere.process.ProcessInfo;
import org.compiere.util.CLogger;
import net.sf.compilo.report.ReportProcessor;
import net.sf.jasperreports.engine.JasperPrint;
/**
* Report Server Bean.
*
* @ejb:bean name="mycompiere/ReportServer"
* display-name="Compiere Report Server Session Bean"
* type="Stateless"
* transaction-type="Bean"
* jndi-name="ejb/mycompiere/ReportServer"
*
* @ejb:ejb-ref ejb-name="mycompiere/ReportServer"
* ref-name="mycompiere/ReportServer"
*
* @author Peter Shen
* @version $Id: ReportServerBean.java,v 1.1 2005/07/15 10:29:40 pshen Exp $
*/
public class ReportServerBean implements SessionBean
{
/** Context */
private SessionContext m_Context;
/** Logging */
private transient CLogger log = CLogger.getCLogger(getClass());
private static int s_no = 0;
private int m_no = 0;
/**
* Create the Session Bean
* @throws CreateException
* @ejb:create-method view-type="remote"
*/
public void ejbCreate() throws CreateException
{
m_no = ++s_no;
if (log == null)
log = CLogger.getCLogger(getClass());
log.info("ejbCreate " + m_no);
} // ejbCreate
/**
* Process Remote
* @ejb:interface-method view-type="remote"
*
* @param ctx Context
* @param pi Process Info
* @return JasperPrint
* @throws RemoteException
*/
public JasperPrint runReport(Properties ctx, ProcessInfo pi)
throws RemoteException
{
ReportProcessor rp = new ReportProcessor(ctx, pi);
JasperPrint js = rp.runReport();
return js;
}
// -------------------------------------------------------------------------
// Framework Callbacks
// -------------------------------------------------------------------------
/**
* Method setSessionContext
* @param aContext SessionContext
* @throws EJBException
* @see javax.ejb.SessionBean#setSessionContext(SessionContext)
*/
public void setSessionContext (SessionContext aContext) throws EJBException
{
m_Context = aContext;
}
/**
* Method ejbActivate
* @throws EJBException
* @see javax.ejb.SessionBean#ejbActivate()
*/
public void ejbActivate() throws EJBException
{
if (log == null)
log = CLogger.getCLogger(getClass());
log.finest("ejbActivate " + this);
}
/**
* Method ejbPassivate
* @throws EJBException
* @see javax.ejb.SessionBean#ejbPassivate()
*/
public void ejbPassivate() throws EJBException
{
log.finest("ejbPassivate " + this);
}
/**
* Method ejbRemove
* @throws EJBException
* @see javax.ejb.SessionBean#ejbRemove()
*/
public void ejbRemove() throws EJBException
{
log.finest("ejbRemove " + this);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -