001/**
002 * Copyright 2011 The Kuali Foundation Licensed under the
003 * Educational Community License, Version 2.0 (the "License"); you may
004 * not use this file except in compliance with the License. You may
005 * obtain a copy of the License at
006 *
007 * http://www.osedu.org/licenses/ECL-2.0
008 *
009 * Unless required by applicable law or agreed to in writing,
010 * software distributed under the License is distributed on an "AS IS"
011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012 * or implied. See the License for the specific language governing
013 * permissions and limitations under the License.
014 */
015
016package org.kuali.mobility.alerts.entity;
017
018import java.io.Serializable;
019
020/**
021 * An object representing an alert. Alerts include events such as a crisis,
022 * emergency, or warning on campus.
023 * 
024 * @author Kuali Mobility Team
025 */
026public class Alert implements Serializable, Comparable<Alert> {
027
028        private static final long serialVersionUID = 3298337944905192830L;
029
030        private static final String NORMAL_TYPE = "Normal";
031        private static final String INFO_TYPE = "Information";  
032        private static final String WARNING_TYPE = "Caution";
033        private static final String DANGER_TYPE = "Emergency";
034        
035        
036        private String campus;
037        private String type;
038        private String title;
039        private String priority;
040        private String mobileText;
041        private String url;
042        private int key;
043
044        public String getCampus() {
045                return campus;
046        }
047
048        public void setCampus(String campus) {
049                this.campus = campus;
050        }
051
052        public String getType() {
053                return type;
054        }
055
056        public void setType(String type) {
057                this.type = type;
058        }
059
060        public String getTitle() {
061                return title;
062        }
063
064        public void setTitle(String title) {
065                this.title = title;
066        }
067
068        public String getPriority() {
069                return priority;
070        }
071
072        public void setPriority(String priority) {
073                this.priority = priority;
074        }
075
076        public String getMobileText() {
077                return mobileText;
078        }
079
080        public void setMobileText(String mobileText) {
081                this.mobileText = mobileText;
082        }
083
084        public String getUrl() {
085                return url;
086        }
087
088        public void setUrl(String url) {
089                this.url = url;
090        }
091
092        public int getKey() {
093                return key;
094        }
095
096        public void setKey(int key) {
097                this.key = key;
098        }
099
100        @Override
101        public boolean equals(Object object) {
102                if (object != null) {
103                        Alert alert = (Alert) object;
104                        if ((((this.getCampus() == null || this.getCampus().equals("")) && (alert.getCampus() == null || alert.getCampus().equals(""))) || (this.getCampus() != null && this.getCampus().equals(alert.getCampus()))) && 
105                                (((this.getMobileText() == null || this.getMobileText().equals("")) && (alert.getMobileText() == null || alert.getMobileText().equals(""))) || ( this.getMobileText() != null && this.getMobileText().equals(alert.getMobileText()))) && 
106                                (((this.getPriority() == null || this.getPriority().equals("")) && (alert.getPriority() == null || alert.getPriority().equals(""))) || (this.getPriority() != null && this.getPriority().equals(alert.getPriority()))) && 
107                                (((this.getTitle() == null || this.getTitle().equals("")) && (alert.getTitle() == null || alert.getTitle().equals(""))) || (this.getTitle() != null && this.getTitle().equals(alert.getTitle()))) && 
108                                (((this.getType() == null || this.getType().equals("")) && (alert.getType() == null || alert.getType().equals(""))) || (this.getType() != null && this.getType().equals(alert.getType()))) && 
109                                (((this.getUrl() == null || this.getUrl().equals("")) && (alert.getUrl() == null || alert.getUrl().equals(""))) || (this.getUrl() != null && this.getUrl().equals(alert.getUrl())))) {
110                                return true;
111                        }
112                }
113                return false;
114        }
115
116        public int compareTo(Alert that) {
117                if (this.getCampus() == null || that == null || that.getCampus() == null) {
118                        return -1;
119                }
120                return this.getCampus().compareTo(that.getCampus());
121        }
122
123}