1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.mobility.alerts.entity;
17
18 import org.kuali.mobility.xml.DateAdapter;
19
20 import javax.xml.bind.annotation.XmlAccessType;
21 import javax.xml.bind.annotation.XmlAccessorType;
22 import javax.xml.bind.annotation.XmlElement;
23 import javax.xml.bind.annotation.XmlRootElement;
24 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
25 import java.io.Serializable;
26 import java.util.Date;
27
28
29
30
31
32
33
34 @XmlAccessorType(XmlAccessType.FIELD)
35 @XmlRootElement(name="alert")
36 public class Alert implements Serializable, Comparable<Alert> {
37
38 private static final long serialVersionUID = 3298337944905192830L;
39
40 private static final String NORMAL_TYPE = "Normal";
41 private static final String INFO_TYPE = "Information";
42 private static final String WARNING_TYPE = "Caution";
43 private static final String DANGER_TYPE = "Emergency";
44
45 private String campus;
46 private String type;
47 private String title;
48 private String priority;
49 private String mobileText;
50 private String url;
51 private int key;
52
53 @XmlElement(name="timeIssued", required=true)
54 @XmlJavaTypeAdapter(DateAdapter.class)
55 private Date timeIssued;
56 @XmlElement(name="timeExpires", required=false)
57 @XmlJavaTypeAdapter(DateAdapter.class)
58 private Date timeExpires;
59
60 public String getCampus() {
61 return campus;
62 }
63
64 public void setCampus(String campus) {
65 this.campus = campus;
66 }
67
68 public String getType() {
69 return type;
70 }
71
72 public void setType(String type) {
73 this.type = type;
74 }
75
76 public String getTitle() {
77 return title;
78 }
79
80 public void setTitle(String title) {
81 this.title = title;
82 }
83
84 public String getPriority() {
85 return priority;
86 }
87
88 public void setPriority(String priority) {
89 this.priority = priority;
90 }
91
92 public String getMobileText() {
93 return mobileText;
94 }
95
96 public void setMobileText(String mobileText) {
97 this.mobileText = mobileText;
98 }
99
100 public String getUrl() {
101 return url;
102 }
103
104 public void setUrl(String url) {
105 this.url = url;
106 }
107
108 public int getKey() {
109 return key;
110 }
111
112 public void setKey(int key) {
113 this.key = key;
114 }
115
116 @Override
117 public boolean equals(Object object) {
118 if (object != null) {
119 Alert alert = (Alert) object;
120 if ((((this.getCampus() == null || this.getCampus().equals("")) && (alert.getCampus() == null || alert.getCampus().equals(""))) || (this.getCampus() != null && this.getCampus().equals(alert.getCampus()))) &&
121 (((this.getMobileText() == null || this.getMobileText().equals("")) && (alert.getMobileText() == null || alert.getMobileText().equals(""))) || ( this.getMobileText() != null && this.getMobileText().equals(alert.getMobileText()))) &&
122 (((this.getPriority() == null || this.getPriority().equals("")) && (alert.getPriority() == null || alert.getPriority().equals(""))) || (this.getPriority() != null && this.getPriority().equals(alert.getPriority()))) &&
123 (((this.getTitle() == null || this.getTitle().equals("")) && (alert.getTitle() == null || alert.getTitle().equals(""))) || (this.getTitle() != null && this.getTitle().equals(alert.getTitle()))) &&
124 (((this.getType() == null || this.getType().equals("")) && (alert.getType() == null || alert.getType().equals(""))) || (this.getType() != null && this.getType().equals(alert.getType()))) &&
125 (((this.getUrl() == null || this.getUrl().equals("")) && (alert.getUrl() == null || alert.getUrl().equals(""))) || (this.getUrl() != null && this.getUrl().equals(alert.getUrl())))) {
126 return true;
127 }
128 }
129 return false;
130 }
131
132 public int compareTo(Alert that) {
133 if (this.getCampus() == null || that == null || that.getCampus() == null) {
134 return -1;
135 }
136 return this.getCampus().compareTo(that.getCampus());
137 }
138
139 public Date getTimeIssued() {
140 return timeIssued;
141 }
142
143 public void setTimeIssued(Date timeIssued) {
144 this.timeIssued = timeIssued;
145 }
146
147 public Date getTimeExpires() {
148 return timeExpires;
149 }
150
151 public void setTimeExpires(Date timeExpires) {
152 this.timeExpires = timeExpires;
153 }
154 }