Package org.compiere.server
Class AlertProcessor
- java.lang.Object
-
- org.compiere.server.AdempiereServer
-
- org.compiere.server.AlertProcessor
-
- All Implemented Interfaces:
Runnable
public class AlertProcessor extends AdempiereServer
Alert Processor- Version:
- $Id: AlertProcessor.java,v 1.4 2006/07/30 00:53:33 jjanke Exp $
- Author:
- Jorg Janke, Teo Sarca, SC ARHIPAC SERVICE SRL
- FR [ 1894573 ] Alert Processor Improvements
- FR [ 2453882 ] Alert Processor : attached file name improvement, Kubotti
- BF [ 2785633 ] Adding a Notice in Alert Processor
-
-
Field Summary
Fields Modifier and Type Field Description protected MClient
m_client
Client infoprotected StringBuffer
m_errors
Last Error Msgprotected MAlertProcessor
m_model
The Concrete Modelprotected StringBuffer
m_summary
Last Summary-
Fields inherited from class org.compiere.server.AdempiereServer
log, m_sleepMS, m_start, p_client, p_model, p_runCount, p_startWork, p_system
-
-
Constructor Summary
Constructors Constructor Description AlertProcessor(MAlertProcessor model)
Alert Processor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doWork()
Workprotected ArrayList<ArrayList<Object>>
getData(String sql, String trxName)
Get Alert Dataprotected String
getExcelReport(MAlertRule rule, String sql, Language language, String trxName, Collection<File> attachments)
Get Excel Reportprotected String
getPlainTextReport(MAlertRule rule, String sql, String trxName, Collection<File> attachments)
Get Plain Text Report (old functionality)String
getServerInfo()
Get Server Infoprotected int
notifyUsers(Collection<Integer> users, String subject, String message, Collection<File> attachments, MAlert alert)
Notify usersprotected boolean
processAlert(MAlert alert, Language language)
Process Alert-
Methods inherited from class org.compiere.server.AdempiereServer
doRun, doRunNow, getCtx, getDateLastRun, getDateNextRun, getDescription, getInitialNap, getLogs, getModel, getName, getSecondsAlive, getServerID, getSleepMS, getStartTime, getStatistics, isInterrupted, isOKtoRunOnIP, isSleeping, recalculateSleepMS, run, runNow, toString
-
-
-
-
Field Detail
-
m_model
protected MAlertProcessor m_model
The Concrete Model
-
m_summary
protected StringBuffer m_summary
Last Summary
-
m_errors
protected StringBuffer m_errors
Last Error Msg
-
m_client
protected MClient m_client
Client info
-
-
Constructor Detail
-
AlertProcessor
public AlertProcessor(MAlertProcessor model)
Alert Processor- Parameters:
model
- model
-
-
Method Detail
-
doWork
protected void doWork()
Work- Specified by:
doWork
in classAdempiereServer
-
processAlert
protected boolean processAlert(MAlert alert, Language language)
Process Alert- Parameters:
alert
- alert- Returns:
- true if processed
-
notifyUsers
protected int notifyUsers(Collection<Integer> users, String subject, String message, Collection<File> attachments, MAlert alert)
Notify users- Parameters:
users
- AD_User_ID listsubject
- email subjectmessage
- email messageattachments
-alert
-- Returns:
- how many email were sent
-
getData
protected ArrayList<ArrayList<Object>> getData(String sql, String trxName) throws Exception
Get Alert Data- Parameters:
sql
-trxName
-- Returns:
- data
- Throws:
Exception
-
getPlainTextReport
protected String getPlainTextReport(MAlertRule rule, String sql, String trxName, Collection<File> attachments) throws Exception
Get Plain Text Report (old functionality)- Parameters:
rule
- (ignored)sql
- sql selecttrxName
- transactionattachments
- (ignored)- Returns:
- list of rows and values
- Throws:
Exception
-
getExcelReport
protected String getExcelReport(MAlertRule rule, String sql, Language language, String trxName, Collection<File> attachments) throws Exception
Get Excel Report- Parameters:
rule
-sql
-trxName
-attachments
-- Returns:
- summary message to be added into mail content
- Throws:
Exception
-
getServerInfo
public String getServerInfo()
Get Server Info- Specified by:
getServerInfo
in classAdempiereServer
- Returns:
- info
-
-