/andrico/src/org/andrico/andrico/content/Contact.java
Java | 268 lines | 223 code | 28 blank | 17 comment | 34 complexity | 709fee53e5e3457914d5d94b5335d77b MD5 | raw file
1 /*************************************************************************** 2 * Copyright (C) 2009 Andrico Team * 3 * http://code.google.com/p/andrico/ * 4 * * 5 * Licensed under the Apache License, Version 2.0 (the "License"); * 6 * you may not use this file except in compliance with the License. * 7 * * 8 * You may obtain a copy of the License at * 9 * http://www.apache.org/licenses/LICENSE-2.0 * 10 * * 11 * Unless required by applicable law or agreed to in writing, software * 12 * distributed under the License is distributed on an "AS IS" BASIS, * 13 * * 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 15 * See the License for the specific language governing permissions and * 16 * limitations under the License. * 17 ****************************************************************************/ 18 19package org.andrico.andrico.content; 20 21public class Contact{ 22 private String fbId;//facebook id 23 private String name; 24 private String secondName; 25 private String dateOfBirth; 26 private String adress; 27 private String page; 28 private String smallPic; 29 private byte[] photo; 30 private int id; //id in db 31 32 33 34 public Contact() 35 { 36 name = ""; 37 secondName = ""; 38 dateOfBirth = ""; 39 adress = ""; 40 page = ""; 41 smallPic = ""; 42 byte[] ar = {0}; 43 photo = ar; 44 } 45 46 public boolean Equals(Contact cont) 47 { 48 if (!(this.getName().equals(cont.getName())) || !(this.getSecondName().equals(cont.getSecondName())) || 49 (!this.getFBid().equals(cont.getFBid())) || (!this.getAdress().equals(cont.getAdress())) || 50 (!this.getPage().equals(cont.getPage())) || (!this.getPic().equals(cont.getPic()))) 51 { 52 return false; 53 } 54 else 55 { 56 return true; 57 } 58 } 59 60 public int getId() 61 { 62 return id; 63 } 64 65 public void setId(int id) 66 { 67 this.id = id; 68 } 69 70 public String getName() 71 { 72 if (name != null) 73 { 74 return name; 75 } 76 else 77 { 78 return ""; 79 } 80 } 81 82 public void setName(String name) 83 { 84 if (name != null) 85 { 86 this.name = name; 87 } 88 else 89 { 90 this.name = ""; 91 } 92 } 93 94 public String getSecondName() 95 { 96 if (secondName != null) 97 { 98 return secondName; 99 } 100 else 101 { 102 return ""; 103 } 104 } 105 106 public void setSecondName(String secondName) 107 { 108 if (secondName != null) 109 { 110 this.secondName = secondName; 111 } 112 else 113 { 114 this.secondName = ""; 115 } 116 } 117 118 public String getDateOfBirth() 119 { 120 if (dateOfBirth != null) 121 { 122 return dateOfBirth; 123 } 124 else 125 { 126 return ""; 127 } 128 129 } 130 131 public void setDateOfBirth(String date) 132 { 133 if (date != null) 134 { 135 this.dateOfBirth = date; 136 } 137 else 138 { 139 this.dateOfBirth = ""; 140 } 141 } 142 143 public String getAdress() 144 { 145 if (adress != null) 146 { 147 return adress; 148 } 149 else 150 { 151 return ""; 152 } 153 } 154 155 public void setAdress(String info) 156 { 157 if (info != null) 158 { 159 this.adress = info; 160 } 161 else 162 { 163 this.adress = ""; 164 } 165 } 166 167 public String getPage() 168 { 169 if (page != null) 170 { 171 return page; 172 } 173 else 174 { 175 return ""; 176 } 177 } 178 179 public void setPage(String info) 180 { 181 if (info != null) 182 { 183 this.page = info; 184 } 185 else 186 { 187 this.page = ""; 188 } 189 } 190 191 public String getFBid() 192 { 193 return fbId; 194 } 195 196 public void setFBid(String info) 197 { 198 this.fbId = info; 199 } 200 201 public String getPic() 202 { 203 if (smallPic != null) 204 { 205 return smallPic; 206 } 207 else 208 { 209 return ""; 210 } 211 } 212 213 public void setPic(String url) 214 { 215 if (url != null) 216 { 217 this.smallPic = url; 218 } 219 else 220 { 221 this.smallPic = ""; 222 } 223 } 224 225 public byte[] getPhoto() 226 { 227 if (photo != null) 228 { 229 return photo; 230 } 231 else 232 { 233 byte[] arr = {0}; 234 return arr; 235 } 236 } 237 238 public void setPhoto(byte[] photo) 239 { 240 if(photo != null) 241 { 242 this.photo = photo; 243 } 244 else 245 { 246 byte[] arr = {0}; 247 this.photo = arr; 248 } 249 } 250 251 252 public String toString() 253 { 254 return "facebook id: " + fbId +"name: " + name + " second name: " + secondName + " date of birth: " + dateOfBirth + " adress: " + adress + " id: " + id; 255 } 256 257 public void copyTo(Contact newContact) 258 { 259 newContact.setDateOfBirth(this.getDateOfBirth()); 260 newContact.setAdress(this.getAdress()); 261 newContact.setFBid(this.getFBid()); 262 newContact.setName(this.getName()); 263 newContact.setPage(this.getPage()); 264 newContact.setPic(this.getPic()); 265 newContact.setPhoto(this.getPhoto()); 266 newContact.setSecondName(this.getSecondName()); 267 } 268}