View Javadoc

1   /**
2    * Copyright 2011 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.mobility.alerts.entity;
17  
18  import java.io.Serializable;
19  
20  /**
21   * An object representing an alert. Alerts include events such as a crisis,
22   * emergency, or warning on campus.
23   * 
24   * @author Kuali Mobility Team
25   */
26  public class Alert implements Serializable, Comparable<Alert> {
27  
28  	private static final long serialVersionUID = 3298337944905192830L;
29  
30  	private String campus;
31  	private String type;
32  	private String title;
33  	private String priority;
34  	private String mobileText;
35  	private String url;
36  	private int key;
37  
38  	public String getCampus() {
39  		return campus;
40  	}
41  
42  	public void setCampus(String campus) {
43  		this.campus = campus;
44  	}
45  
46  	public String getType() {
47  		return type;
48  	}
49  
50  	public void setType(String type) {
51  		this.type = type;
52  	}
53  
54  	public String getTitle() {
55  		return title;
56  	}
57  
58  	public void setTitle(String title) {
59  		this.title = title;
60  	}
61  
62  	public String getPriority() {
63  		return priority;
64  	}
65  
66  	public void setPriority(String priority) {
67  		this.priority = priority;
68  	}
69  
70  	public String getMobileText() {
71  		return mobileText;
72  	}
73  
74  	public void setMobileText(String mobileText) {
75  		this.mobileText = mobileText;
76  	}
77  
78  	public String getUrl() {
79  		return url;
80  	}
81  
82  	public void setUrl(String url) {
83  		this.url = url;
84  	}
85  
86  	public int getKey() {
87  		return key;
88  	}
89  
90  	public void setKey(int key) {
91  		this.key = key;
92  	}
93  
94  	@Override
95  	public boolean equals(Object object) {
96  		if (object != null) {
97  			Alert alert = (Alert) object;
98  			if ((((this.getCampus() == null || this.getCampus().equals("")) && (alert.getCampus() == null || alert.getCampus().equals(""))) || (this.getCampus() != null && this.getCampus().equals(alert.getCampus()))) && 
99  				(((this.getMobileText() == null || this.getMobileText().equals("")) && (alert.getMobileText() == null || alert.getMobileText().equals(""))) || ( this.getMobileText() != null && this.getMobileText().equals(alert.getMobileText()))) && 
100 				(((this.getPriority() == null || this.getPriority().equals("")) && (alert.getPriority() == null || alert.getPriority().equals(""))) || (this.getPriority() != null && this.getPriority().equals(alert.getPriority()))) && 
101 				(((this.getTitle() == null || this.getTitle().equals("")) && (alert.getTitle() == null || alert.getTitle().equals(""))) || (this.getTitle() != null && this.getTitle().equals(alert.getTitle()))) && 
102 				(((this.getType() == null || this.getType().equals("")) && (alert.getType() == null || alert.getType().equals(""))) || (this.getType() != null && this.getType().equals(alert.getType()))) && 
103 				(((this.getUrl() == null || this.getUrl().equals("")) && (alert.getUrl() == null || alert.getUrl().equals(""))) || (this.getUrl() != null && this.getUrl().equals(alert.getUrl())))) {
104 				return true;
105 			}
106 		}
107 		return false;
108 	}
109 
110 	public int compareTo(Alert that) {
111 		if (this.getCampus() == null || that == null || that.getCampus() == null) {
112 			return -1;
113 		}
114 		return this.getCampus().compareTo(that.getCampus());
115 	}
116 
117 }