use of org.compiere.model.MAlertProcessorLog in project adempiere by adempiere.
the class AlertProcessor method doWork.
/**
* Work
*/
protected void doWork() {
m_summary = new StringBuffer();
m_errors = new StringBuffer();
//
int count = 0;
int countError = 0;
MAlert[] alerts = m_model.getAlerts(false);
for (int i = 0; i < alerts.length; i++) {
if (!processAlert(alerts[i]))
countError++;
count++;
}
//
String summary = "Total=" + count;
if (countError > 0)
summary += ", Not processed=" + countError;
summary += " - ";
m_summary.insert(0, summary);
//
int no = m_model.deleteLog();
m_summary.append("Logs deleted=").append(no);
//
MAlertProcessorLog pLog = new MAlertProcessorLog(m_model, m_summary.toString());
pLog.setReference("#" + String.valueOf(p_runCount) + " - " + TimeUtil.formatElapsed(new Timestamp(p_startWork)));
pLog.setTextMsg(m_errors.toString());
pLog.saveEx();
}
use of org.compiere.model.MAlertProcessorLog in project adempiere by adempiere.
the class AlertTest method testAlertProcessor.
public void testAlertProcessor() {
MAlertProcessor alertpro = new MAlertProcessor(getCtx(), 100, null);
alertpro.setAD_AlertProcessor_ID(100);
MAlertProcessorLog[] test = (MAlertProcessorLog[]) alertpro.getLogs();
assertTrue("Alert Processor has logs", test.length > 0);
MAlert[] alerts = (MAlert[]) alertpro.getAlerts(true);
assertTrue("There are alerts", alerts.length > 0);
assertTrue("There are active recs", MAlertProcessor.getActive(getCtx()).length > 0);
}
Aggregations