/*
* Copyright 2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eclserver.db.objects;
/**
*
* @author rbalsewich
*/
public class RecipientObject {
/**
* Creates a new instance of ServerObject
*/
public RecipientObject() {
}
public RecipientObject(String recEmail){
this(recEmail, "", "", "", -1);
}
public RecipientObject(String recEmail, String recUserBes, String recMatched, String recSyncDate) {
this(recEmail, recUserBes, recMatched, recSyncDate, -1);
}
public RecipientObject(String recEmail, String recUserBes, String recMatched, String recSyncDate, int id) {
this.recEmail = recEmail;
this.recUserBes = recUserBes;
this.recMatched = recMatched;
this.recSyncDate = recSyncDate;
this.id = id;
}
public void setRecEmail(String value) {
this.recEmail = value;
}
public String getRecEmail() {
return recEmail;
}
public void setUserBes(String value) {
this.recUserBes = value;
}
public String getUserBes() {
return recUserBes;
}
public void setMatched(String value){
this.recMatched = value;
}
public String getMatched() {
return recMatched;
}
public void setSyncDate(String value){
this.recSyncDate = value;
}
public String getSyncDate(){
return recSyncDate;
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
public String getRecListObject(){
String value = "(email): " + recEmail + " (BES Server): " + recUserBes;
return value;
}
public int hashCode() {
int value = 1;
value = value*PRIMENO + (recEmail == null ? 0 : recEmail.hashCode());
value = value*PRIMENO + (recUserBes == null ? 0 : recUserBes.hashCode());
value = value*PRIMENO + (recSyncDate == null ? 0 : recSyncDate.hashCode());
// don't use the id since this is generated by db
return value;
}
public boolean equals(Object other) {
boolean bEqual = false;
if (this == other) {
bEqual = true;
} else if (other instanceof RecipientObject) {
RecipientObject thatRecipientObject = (RecipientObject) other;
if ((recEmail == null ? thatRecipientObject.recEmail == null : recEmail.equalsIgnoreCase(thatRecipientObject.recEmail)) &&
(recUserBes == null ? thatRecipientObject.recUserBes == null : recUserBes.equalsIgnoreCase(thatRecipientObject.recUserBes)) &&
(recMatched == null ? thatRecipientObject.recMatched == null : recMatched.equalsIgnoreCase(thatRecipientObject.recMatched)) &&
(recSyncDate == null ? thatRecipientObject.recSyncDate == null : recSyncDate.equalsIgnoreCase(thatRecipientObject.recSyncDate))) {
// don't use id in determining equality
bEqual = true;
}
}
return bEqual;
}
private String recEmail;
private String recUserBes;
private String recMatched;
private String recSyncDate;
private int id;
private static final int PRIMENO = 37;
}