/andrico/src/org/andrico/andrico/content/Contact.java

http://andrico.googlecode.com/ · 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. package org.andrico.andrico.content;
  19. public class Contact{
  20. private String fbId;//facebook id
  21. private String name;
  22. private String secondName;
  23. private String dateOfBirth;
  24. private String adress;
  25. private String page;
  26. private String smallPic;
  27. private byte[] photo;
  28. private int id; //id in db
  29. public Contact()
  30. {
  31. name = "";
  32. secondName = "";
  33. dateOfBirth = "";
  34. adress = "";
  35. page = "";
  36. smallPic = "";
  37. byte[] ar = {0};
  38. photo = ar;
  39. }
  40. public boolean Equals(Contact cont)
  41. {
  42. if (!(this.getName().equals(cont.getName())) || !(this.getSecondName().equals(cont.getSecondName())) ||
  43. (!this.getFBid().equals(cont.getFBid())) || (!this.getAdress().equals(cont.getAdress())) ||
  44. (!this.getPage().equals(cont.getPage())) || (!this.getPic().equals(cont.getPic())))
  45. {
  46. return false;
  47. }
  48. else
  49. {
  50. return true;
  51. }
  52. }
  53. public int getId()
  54. {
  55. return id;
  56. }
  57. public void setId(int id)
  58. {
  59. this.id = id;
  60. }
  61. public String getName()
  62. {
  63. if (name != null)
  64. {
  65. return name;
  66. }
  67. else
  68. {
  69. return "";
  70. }
  71. }
  72. public void setName(String name)
  73. {
  74. if (name != null)
  75. {
  76. this.name = name;
  77. }
  78. else
  79. {
  80. this.name = "";
  81. }
  82. }
  83. public String getSecondName()
  84. {
  85. if (secondName != null)
  86. {
  87. return secondName;
  88. }
  89. else
  90. {
  91. return "";
  92. }
  93. }
  94. public void setSecondName(String secondName)
  95. {
  96. if (secondName != null)
  97. {
  98. this.secondName = secondName;
  99. }
  100. else
  101. {
  102. this.secondName = "";
  103. }
  104. }
  105. public String getDateOfBirth()
  106. {
  107. if (dateOfBirth != null)
  108. {
  109. return dateOfBirth;
  110. }
  111. else
  112. {
  113. return "";
  114. }
  115. }
  116. public void setDateOfBirth(String date)
  117. {
  118. if (date != null)
  119. {
  120. this.dateOfBirth = date;
  121. }
  122. else
  123. {
  124. this.dateOfBirth = "";
  125. }
  126. }
  127. public String getAdress()
  128. {
  129. if (adress != null)
  130. {
  131. return adress;
  132. }
  133. else
  134. {
  135. return "";
  136. }
  137. }
  138. public void setAdress(String info)
  139. {
  140. if (info != null)
  141. {
  142. this.adress = info;
  143. }
  144. else
  145. {
  146. this.adress = "";
  147. }
  148. }
  149. public String getPage()
  150. {
  151. if (page != null)
  152. {
  153. return page;
  154. }
  155. else
  156. {
  157. return "";
  158. }
  159. }
  160. public void setPage(String info)
  161. {
  162. if (info != null)
  163. {
  164. this.page = info;
  165. }
  166. else
  167. {
  168. this.page = "";
  169. }
  170. }
  171. public String getFBid()
  172. {
  173. return fbId;
  174. }
  175. public void setFBid(String info)
  176. {
  177. this.fbId = info;
  178. }
  179. public String getPic()
  180. {
  181. if (smallPic != null)
  182. {
  183. return smallPic;
  184. }
  185. else
  186. {
  187. return "";
  188. }
  189. }
  190. public void setPic(String url)
  191. {
  192. if (url != null)
  193. {
  194. this.smallPic = url;
  195. }
  196. else
  197. {
  198. this.smallPic = "";
  199. }
  200. }
  201. public byte[] getPhoto()
  202. {
  203. if (photo != null)
  204. {
  205. return photo;
  206. }
  207. else
  208. {
  209. byte[] arr = {0};
  210. return arr;
  211. }
  212. }
  213. public void setPhoto(byte[] photo)
  214. {
  215. if(photo != null)
  216. {
  217. this.photo = photo;
  218. }
  219. else
  220. {
  221. byte[] arr = {0};
  222. this.photo = arr;
  223. }
  224. }
  225. public String toString()
  226. {
  227. return "facebook id: " + fbId +"name: " + name + " second name: " + secondName + " date of birth: " + dateOfBirth + " adress: " + adress + " id: " + id;
  228. }
  229. public void copyTo(Contact newContact)
  230. {
  231. newContact.setDateOfBirth(this.getDateOfBirth());
  232. newContact.setAdress(this.getAdress());
  233. newContact.setFBid(this.getFBid());
  234. newContact.setName(this.getName());
  235. newContact.setPage(this.getPage());
  236. newContact.setPic(this.getPic());
  237. newContact.setPhoto(this.getPhoto());
  238. newContact.setSecondName(this.getSecondName());
  239. }
  240. }