Back to project page Android-Universal-Notifier.
The source code is released under:
Apache License
If you think the Android project Android-Universal-Notifier listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.mairos.universalnotifier.model; //from w w w. j a v a 2 s . c om import java.util.ArrayList; import java.util.Date; public class NotificationTask { public static final String SMS_CHANNEL = "SMS"; public static final String EMAIL_CHANNEL = "email"; public static final String TASK_NAME = "task_name"; private String m_name = "default task name"; private boolean m_repeate = false; private Date m_start_time = null; private Date m_finish_time = null; private int m_interval = 1; private int m_lifetime = 300; private String m_JS_script = "ya.ru"; private String m_channel = EMAIL_CHANNEL; private String m_email_login = ""; private String m_email_pwd = ""; private ArrayList<String> m_persons = null; private ArrayList<AttachmentData> m_attachments = null; private boolean m_scheduled = false; public void setSheduled(boolean f_scheduled){ m_scheduled = f_scheduled; } public boolean isScheduled(){ return m_scheduled; } @Override public boolean equals(Object o) { NotificationTask compareWith = (NotificationTask) o; return this.m_name.equals(compareWith.m_name) && this.m_channel.equals(compareWith.m_channel) && (this.m_repeate == compareWith.m_repeate) && (this.m_start_time.equals(compareWith.m_start_time)) && (this.m_lifetime == compareWith.m_lifetime) && (this.m_interval == compareWith.m_interval); } @Override public int hashCode() { return m_name.hashCode(); } public String getName() { return m_name; } public void addAttachment(AttachmentData f_attachment){ boolean exist = false; for (int i = 0; i < m_attachments.size(); i++) { if (m_attachments.get(i).getFileName().equals(f_attachment.getFileName())) exist = true; } if (!exist) m_attachments.add(f_attachment); } public boolean getRepeatable() { return m_repeate; } public Date getStartTime() { return m_start_time; } public Date setStartTime(Date f_start_time) { return m_start_time = f_start_time; } public Date getFinishTime() { return m_finish_time; } public int getInterval() { return m_interval*/*60*60**/1000; } public int getLifetime() { return m_lifetime*1000; } public String getJS_script() { return m_JS_script; } public String getChannel() { return m_channel; } public String getEmailLogin() { return m_email_login; } public String getEmailPwd() { return m_email_pwd; } public ArrayList<String> getPersons() { return m_persons; } public ArrayList<AttachmentData> getAttachments() { return m_attachments; } public String getPersonsString() { String res = ""; for (int i = 0; i < m_persons.size(); i++) { res += m_persons.get(i); if (i != m_persons.size()-1) res += ","; } return res; } public String toString(){ String res = ""; res += "Task name = " + m_name + "\n"; res += "repeate = " + ((m_repeate) ? "regular" : "once") + "\n"; res += "start_time = " + m_start_time.toString() + "\n"; if (m_repeate) res += "finish_time = " + m_finish_time.toString() + "\n"; if (m_repeate) res += "interval = " + Integer.toString(m_interval) + " seconds\n"; res += "lifetime = " + m_lifetime + "\n"; res += "JS_script = " + m_JS_script + " seconds\n"; res += "channel = " + m_channel + "\n"; res += "persons = " + getPersonsString(); for (int i = 0; i < m_attachments.size(); i++) { if (m_attachments.get(i).getType().equals(AttachmentData.FTP_TYPE)){ res += "\n"+"attachment from FTP, server = " + m_attachments.get(i).getPath() + ", login = " + m_attachments.get(i).getLogin() + ", password = " + m_attachments.get(i).getPassword() + ", file = " + m_attachments.get(i).getFileName(); } else if (m_attachments.get(i).getType().equals(AttachmentData.WEB_TYPE)){ res += "\n"+"attachment from WEB, path = " + m_attachments.get(i).getPath(); } } return res; } // repeat public NotificationTask(String f_name, Date f_start_time, Date f_finish_time, int f_interval, int f_lifetime, String f_JS_script, String f_channel, String f_email_login, String f_email_pwd, ArrayList<String> f_persons, ArrayList<AttachmentData> f_attachments){ m_name = f_name; m_repeate = true; m_start_time = f_start_time; m_finish_time = f_finish_time; m_interval = f_interval; m_lifetime = f_lifetime; m_JS_script = f_JS_script; m_channel = f_channel; if (f_email_login != "") m_email_login = f_email_login; if (f_email_pwd != "") m_email_pwd = f_email_pwd; m_persons = f_persons; m_attachments = f_attachments; } // once public NotificationTask(String f_name, Date f_start_time, int f_lifetime, String f_JS_script, String f_channel, String f_email_login, String f_email_pwd, ArrayList<String> f_persons, ArrayList<AttachmentData> f_attachments){ m_name = f_name; m_repeate = false; m_start_time = f_start_time; m_lifetime = f_lifetime; m_JS_script = f_JS_script; m_channel = f_channel; if (f_email_login != "") m_email_login = f_email_login; if (f_email_pwd != "") m_email_pwd = f_email_pwd; m_persons = f_persons; m_attachments = f_attachments; } }