📄 sendcallsthread.java
字号:
/* CRMS, customer relationship management system Copyright (C) 2003 Service To Youth Council This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information contact the SYC ICT department on GPL@syc.net.au 98 Kermode Street North Adelaide South Australia SA 5006 +61 (0)8 8367 0755 *//* * SendRemindersThread.java * * Created on 20 June 2003, 10:18 */package crms.daemon;import java.util.*;import crms.vo.*;import crms.dao.*;import java.sql.*;import org.apache.log4j.Logger;/** * * @author Administrator */public class SendCallsThread { Logger logger = Logger.getLogger(SendRemindersThread.class); private ArrayList callList = null; private CallDAO dao = DAOFactory.getInstance().getCallDAO(); /** Creates a new instance of SendCallsThread */ public SendCallsThread(List calls) { callList = (ArrayList) calls; } public void run() { logger.debug("Processing " + callList.size() + " calls.."); for (int i=0; i < callList.size(); i++) { Call call = (Call) callList.get(i); boolean result = sendCall(call); if (result) { updateDBReminderStatus(call); } } } public void updateDBReminderStatus(Call call) { try { MessageLogEntry entry = MessageLogEntry.createFromCall(call); if (call.checkFlag(Call.CALL_FLAG_EMAIL)) { call.changeFlag(Call.CALL_FLAG_EMAIL_SENT, true); } if (call.checkFlag(Call.CALL_FLAG_SMS)) { call.changeFlag(Call.CALL_FLAG_SMS_SENT, true); } dao.updateCall(call); //dao.addReminderLogEntry(entry, null); } catch (Exception ex) { logger.fatal(ex); throw new RuntimeException("Exception updating Call status!", ex); } } public boolean sendCall(Call call) { boolean result = true; if (call.checkFlag(Call.CALL_FLAG_SMS)) { result = sendSMSCall(call); } if (call.checkFlag(Call.CALL_FLAG_EMAIL)) { result = result && sendEmailCall(call); } return result; } public boolean sendSMSCall(Call c) { logger.debug("Attempt to send SMS reminder to " + c.getOwner()); try { SendSMSThread thread = new SendSMSThread(c); thread.run(); } catch (Exception ex) { logger.fatal(ex); return false; } return true; } public boolean sendEmailCall(Call c) { logger.debug("Attempt to send email reminder to " + c.getOwner()); try { SendEmailThread thread = new SendEmailThread(c); thread.run(); }catch (Exception ex) { logger.fatal(ex); return false; } return true; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -