📄 serverbean.java
字号:
} // paymentOnline
/**
* Create EMail from Server (Request User)
* @ejb.interface-method view-type="both"
* @param ctx Context
* @param AD_Client_ID client
* @param to recipient email address
* @param subject subject
* @param message message
* @return EMail
*/
public EMail createEMail (Properties ctx, int AD_Client_ID,
String to, String subject, String message)
{
MClient client = MClient.get(ctx, AD_Client_ID);
return client.createEMail(to, subject, message);
} // createEMail
/**
* Create EMail from Server (Request User)
* @ejb.interface-method view-type="both"
* @param ctx Context
* @param AD_Client_ID client
* @param to recipient email address
* @param subject subject
* @param message message
* @return EMail
*/
public EMail createEMail (Properties ctx, int AD_Client_ID,
int AD_User_ID,
String to, String subject, String message)
{
MClient client = MClient.get(ctx, AD_Client_ID);
MUser from = new MUser (ctx, AD_User_ID, null);
return client.createEMail(from, to, subject, message);
} // createEMail
/**
* Create EMail from Server (Request User)
* @ejb.interface-method view-type="both"
* @param AD_Task_ID task
* @return execution trace
*/
public String executeTask (int AD_Task_ID)
{
MTask task = new MTask (Env.getCtx(), AD_Task_ID, null); // Server Context
return task.execute();
} // executeTask
/**
* Cash Reset
* @ejb.interface-method view-type="both"
*
* @param tableName table name
* @param Record_ID record or 0 for all
* @return number of records reset
*/
public int cacheReset (String tableName, int Record_ID)
{
log.config(tableName + " - " + Record_ID);
m_cacheResetCount++;
return CacheMgt.get().reset(tableName, Record_ID);
} // cacheReset
/**
* LOB update
* @ejb.interface-method view-type="both"
*
* @param sql table name
* @param displayType display type (i.e. BLOB/CLOB)
* @param value the data
* @return true if updated
*/
public boolean updateLOB (String sql, int displayType, Object value)
{
if (sql == null || value == null)
{
log.fine("No sql or data");
return false;
}
log.fine(sql);
m_updateLOBCount++;
boolean success = true;
Connection con = DB.createConnection(false, Connection.TRANSACTION_READ_COMMITTED);
PreparedStatement pstmt = null;
try
{
pstmt = con.prepareStatement(sql);
if (displayType == DisplayType.TextLong)
pstmt.setString(1, (String)value);
else
pstmt.setBytes(1, (byte[])value);
int no = pstmt.executeUpdate();
//
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.FINE, sql, e);
success = false;
}
// Close Statement
try
{
if (pstmt != null)
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
// Success - commit local trx
if (success)
{
try
{
con.commit();
con.close();
con = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, "commit" , e);
success = false;
}
}
// Error - roll back
if (!success)
{
log.severe ("rollback");
try
{
con.rollback();
con.close();
con = null;
}
catch (Exception ee)
{
log.log(Level.SEVERE, "rollback" , ee);
}
}
// Clean Connection
try
{
if (con != null)
con.close();
con = null;
}
catch (Exception e)
{
con = null;
}
return success;
} // updateLOB
/**************************************************************************
* Describes the instance and its content for debugging purpose
* @ejb.interface-method view-type="both"
* @return Debugging information about the instance and its content
*/
public String getStatus()
{
StringBuffer sb = new StringBuffer("ServerBean[");
sb.append(m_no)
.append("-Window=").append(m_windowCount)
.append(",Post=").append(m_postCount)
.append(",Process=").append(m_processCount)
.append(",NextSeq=").append(m_nextSeqCount)
.append(",Workflow=").append(m_workflowCount)
.append(",Payment=").append(m_paymentCount)
.append(",RowSet=").append(m_stmt_rowSetCount)
.append(",Update=").append(m_stmt_updateCount)
.append(",CacheReset=").append(m_cacheResetCount)
.append(",UpdateLob=").append(m_updateLOBCount)
.append("]");
return sb.toString();
} // getStatus
/**
* String Representation
* @return info
*/
public String toString()
{
return getStatus();
} // toString
/**************************************************************************
* Create the Session Bean
* @throws EJBException, CreateException
* @ejb.create-method view-type="both"
*/
public void ejbCreate() throws EJBException, CreateException
{
m_no = ++s_no;
try
{
Compiere.startup(false);
}
catch (Exception ex)
{
log.log(Level.SEVERE, "ejbCreate", ex);
// throw new CreateException ();
}
log.info ("#" + getStatus());
} // ejbCreate
// -------------------------------------------------------------------------
// 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;
} // setSessionContext
/**
* Method ejbActivate
* @throws EJBException
* @see javax.ejb.SessionBean#ejbActivate()
*/
public void ejbActivate() throws EJBException
{
if (log == null)
log = CLogger.getCLogger(getClass());
log.info ("ejbActivate " + getStatus());
} // ejbActivate
/**
* Method ejbPassivate
* @throws EJBException
* @see javax.ejb.SessionBean#ejbPassivate()
*/
public void ejbPassivate() throws EJBException
{
log.info ("ejbPassivate " + getStatus());
} // ejbPassivate
/**
* Method ejbRemove
* @throws EJBException
* @see javax.ejb.SessionBean#ejbRemove()
*/
public void ejbRemove() throws EJBException
{
log.info ("ejbRemove " + getStatus());
} // ejbRemove
/**************************************************************************
* Dump SerialVersionUID of class
* @param clazz class
*/
protected static void dumpSVUID (Class clazz)
{
String s = clazz.getName()
+ " ==\nstatic final long serialVersionUID = "
+ java.io.ObjectStreamClass.lookup(clazz).getSerialVersionUID()
+ "L;\n";
System.out.println (s);
} // dumpSVUID
/**
* Print UID of used classes.
* R2.5.1h
org.compiere.process.ProcessInfo ==
static final long serialVersionUID = -1993220053515488725L;
org.compiere.util.CStatementVO ==
static final long serialVersionUID = -3393389471515956399L;
org.compiere.model.MQuery ==
static final long serialVersionUID = 1511402030597166113L;
org.compiere.model.POInfo ==
static final long serialVersionUID = -5976719579744948419L;
org.compiere.model.POInfoColumn ==
static final long serialVersionUID = -3983585608504631958L;
org.compiere.model.MWindowVO ==
static final long serialVersionUID = 3802628212531678981L;
org.compiere.model.MTabVO ==
static final long serialVersionUID = 9160212869277319305L;
org.compiere.model.MFieldVO ==
static final long serialVersionUID = 4385061125114436797L;
org.compiere.model.MLookupInfo ==
static final long serialVersionUID = -7958664359250070233L;
*
* * @param args ignored
*/
public static void main (String[] args)
{
dumpSVUID(ProcessInfo.class);
dumpSVUID(CStatementVO.class);
dumpSVUID(MQuery.class);
dumpSVUID(POInfo.class);
dumpSVUID(POInfoColumn.class);
dumpSVUID(MWindowVO.class);
dumpSVUID(MTabVO.class);
dumpSVUID(MFieldVO.class);
dumpSVUID(MLookupInfo.class);
} // main
} // ServerBean
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -