PageRenderTime 57ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/apps/mail-reader/mail-reader-service/src/main/java/com/liferay/mail/reader/model/impl/AccountCacheModel.java

http://github.com/liferay/liferay-portal
Java | 414 lines | 318 code | 76 blank | 20 comment | 71 complexity | 2a1e19665da557b30e603e3e6c6a91e3 MD5 | raw file
Possible License(s): LGPL-2.0
  1. /**
  2. * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or modify it under
  5. * the terms of the GNU Lesser General Public License as published by the Free
  6. * Software Foundation; either version 2.1 of the License, or (at your option)
  7. * any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  12. * details.
  13. */
  14. package com.liferay.mail.reader.model.impl;
  15. import aQute.bnd.annotation.ProviderType;
  16. import com.liferay.mail.reader.model.Account;
  17. import com.liferay.portal.kernel.model.CacheModel;
  18. import com.liferay.portal.kernel.util.HashUtil;
  19. import com.liferay.portal.kernel.util.StringBundler;
  20. import com.liferay.portal.kernel.util.StringPool;
  21. import java.io.Externalizable;
  22. import java.io.IOException;
  23. import java.io.ObjectInput;
  24. import java.io.ObjectOutput;
  25. import java.util.Date;
  26. /**
  27. * The cache model class for representing Account in entity cache.
  28. *
  29. * @author Brian Wing Shun Chan
  30. * @see Account
  31. * @generated
  32. */
  33. @ProviderType
  34. public class AccountCacheModel implements CacheModel<Account>, Externalizable {
  35. @Override
  36. public boolean equals(Object obj) {
  37. if (this == obj) {
  38. return true;
  39. }
  40. if (!(obj instanceof AccountCacheModel)) {
  41. return false;
  42. }
  43. AccountCacheModel accountCacheModel = (AccountCacheModel)obj;
  44. if (accountId == accountCacheModel.accountId) {
  45. return true;
  46. }
  47. return false;
  48. }
  49. @Override
  50. public int hashCode() {
  51. return HashUtil.hash(0, accountId);
  52. }
  53. @Override
  54. public String toString() {
  55. StringBundler sb = new StringBundler(53);
  56. sb.append("{accountId=");
  57. sb.append(accountId);
  58. sb.append(", companyId=");
  59. sb.append(companyId);
  60. sb.append(", userId=");
  61. sb.append(userId);
  62. sb.append(", userName=");
  63. sb.append(userName);
  64. sb.append(", createDate=");
  65. sb.append(createDate);
  66. sb.append(", modifiedDate=");
  67. sb.append(modifiedDate);
  68. sb.append(", address=");
  69. sb.append(address);
  70. sb.append(", personalName=");
  71. sb.append(personalName);
  72. sb.append(", protocol=");
  73. sb.append(protocol);
  74. sb.append(", incomingHostName=");
  75. sb.append(incomingHostName);
  76. sb.append(", incomingPort=");
  77. sb.append(incomingPort);
  78. sb.append(", incomingSecure=");
  79. sb.append(incomingSecure);
  80. sb.append(", outgoingHostName=");
  81. sb.append(outgoingHostName);
  82. sb.append(", outgoingPort=");
  83. sb.append(outgoingPort);
  84. sb.append(", outgoingSecure=");
  85. sb.append(outgoingSecure);
  86. sb.append(", login=");
  87. sb.append(login);
  88. sb.append(", password=");
  89. sb.append(password);
  90. sb.append(", savePassword=");
  91. sb.append(savePassword);
  92. sb.append(", signature=");
  93. sb.append(signature);
  94. sb.append(", useSignature=");
  95. sb.append(useSignature);
  96. sb.append(", folderPrefix=");
  97. sb.append(folderPrefix);
  98. sb.append(", inboxFolderId=");
  99. sb.append(inboxFolderId);
  100. sb.append(", draftFolderId=");
  101. sb.append(draftFolderId);
  102. sb.append(", sentFolderId=");
  103. sb.append(sentFolderId);
  104. sb.append(", trashFolderId=");
  105. sb.append(trashFolderId);
  106. sb.append(", defaultSender=");
  107. sb.append(defaultSender);
  108. sb.append("}");
  109. return sb.toString();
  110. }
  111. @Override
  112. public Account toEntityModel() {
  113. AccountImpl accountImpl = new AccountImpl();
  114. accountImpl.setAccountId(accountId);
  115. accountImpl.setCompanyId(companyId);
  116. accountImpl.setUserId(userId);
  117. if (userName == null) {
  118. accountImpl.setUserName(StringPool.BLANK);
  119. }
  120. else {
  121. accountImpl.setUserName(userName);
  122. }
  123. if (createDate == Long.MIN_VALUE) {
  124. accountImpl.setCreateDate(null);
  125. }
  126. else {
  127. accountImpl.setCreateDate(new Date(createDate));
  128. }
  129. if (modifiedDate == Long.MIN_VALUE) {
  130. accountImpl.setModifiedDate(null);
  131. }
  132. else {
  133. accountImpl.setModifiedDate(new Date(modifiedDate));
  134. }
  135. if (address == null) {
  136. accountImpl.setAddress(StringPool.BLANK);
  137. }
  138. else {
  139. accountImpl.setAddress(address);
  140. }
  141. if (personalName == null) {
  142. accountImpl.setPersonalName(StringPool.BLANK);
  143. }
  144. else {
  145. accountImpl.setPersonalName(personalName);
  146. }
  147. if (protocol == null) {
  148. accountImpl.setProtocol(StringPool.BLANK);
  149. }
  150. else {
  151. accountImpl.setProtocol(protocol);
  152. }
  153. if (incomingHostName == null) {
  154. accountImpl.setIncomingHostName(StringPool.BLANK);
  155. }
  156. else {
  157. accountImpl.setIncomingHostName(incomingHostName);
  158. }
  159. accountImpl.setIncomingPort(incomingPort);
  160. accountImpl.setIncomingSecure(incomingSecure);
  161. if (outgoingHostName == null) {
  162. accountImpl.setOutgoingHostName(StringPool.BLANK);
  163. }
  164. else {
  165. accountImpl.setOutgoingHostName(outgoingHostName);
  166. }
  167. accountImpl.setOutgoingPort(outgoingPort);
  168. accountImpl.setOutgoingSecure(outgoingSecure);
  169. if (login == null) {
  170. accountImpl.setLogin(StringPool.BLANK);
  171. }
  172. else {
  173. accountImpl.setLogin(login);
  174. }
  175. if (password == null) {
  176. accountImpl.setPassword(StringPool.BLANK);
  177. }
  178. else {
  179. accountImpl.setPassword(password);
  180. }
  181. accountImpl.setSavePassword(savePassword);
  182. if (signature == null) {
  183. accountImpl.setSignature(StringPool.BLANK);
  184. }
  185. else {
  186. accountImpl.setSignature(signature);
  187. }
  188. accountImpl.setUseSignature(useSignature);
  189. if (folderPrefix == null) {
  190. accountImpl.setFolderPrefix(StringPool.BLANK);
  191. }
  192. else {
  193. accountImpl.setFolderPrefix(folderPrefix);
  194. }
  195. accountImpl.setInboxFolderId(inboxFolderId);
  196. accountImpl.setDraftFolderId(draftFolderId);
  197. accountImpl.setSentFolderId(sentFolderId);
  198. accountImpl.setTrashFolderId(trashFolderId);
  199. accountImpl.setDefaultSender(defaultSender);
  200. accountImpl.resetOriginalValues();
  201. return accountImpl;
  202. }
  203. @Override
  204. public void readExternal(ObjectInput objectInput) throws IOException {
  205. accountId = objectInput.readLong();
  206. companyId = objectInput.readLong();
  207. userId = objectInput.readLong();
  208. userName = objectInput.readUTF();
  209. createDate = objectInput.readLong();
  210. modifiedDate = objectInput.readLong();
  211. address = objectInput.readUTF();
  212. personalName = objectInput.readUTF();
  213. protocol = objectInput.readUTF();
  214. incomingHostName = objectInput.readUTF();
  215. incomingPort = objectInput.readInt();
  216. incomingSecure = objectInput.readBoolean();
  217. outgoingHostName = objectInput.readUTF();
  218. outgoingPort = objectInput.readInt();
  219. outgoingSecure = objectInput.readBoolean();
  220. login = objectInput.readUTF();
  221. password = objectInput.readUTF();
  222. savePassword = objectInput.readBoolean();
  223. signature = objectInput.readUTF();
  224. useSignature = objectInput.readBoolean();
  225. folderPrefix = objectInput.readUTF();
  226. inboxFolderId = objectInput.readLong();
  227. draftFolderId = objectInput.readLong();
  228. sentFolderId = objectInput.readLong();
  229. trashFolderId = objectInput.readLong();
  230. defaultSender = objectInput.readBoolean();
  231. }
  232. @Override
  233. public void writeExternal(ObjectOutput objectOutput)
  234. throws IOException {
  235. objectOutput.writeLong(accountId);
  236. objectOutput.writeLong(companyId);
  237. objectOutput.writeLong(userId);
  238. if (userName == null) {
  239. objectOutput.writeUTF(StringPool.BLANK);
  240. }
  241. else {
  242. objectOutput.writeUTF(userName);
  243. }
  244. objectOutput.writeLong(createDate);
  245. objectOutput.writeLong(modifiedDate);
  246. if (address == null) {
  247. objectOutput.writeUTF(StringPool.BLANK);
  248. }
  249. else {
  250. objectOutput.writeUTF(address);
  251. }
  252. if (personalName == null) {
  253. objectOutput.writeUTF(StringPool.BLANK);
  254. }
  255. else {
  256. objectOutput.writeUTF(personalName);
  257. }
  258. if (protocol == null) {
  259. objectOutput.writeUTF(StringPool.BLANK);
  260. }
  261. else {
  262. objectOutput.writeUTF(protocol);
  263. }
  264. if (incomingHostName == null) {
  265. objectOutput.writeUTF(StringPool.BLANK);
  266. }
  267. else {
  268. objectOutput.writeUTF(incomingHostName);
  269. }
  270. objectOutput.writeInt(incomingPort);
  271. objectOutput.writeBoolean(incomingSecure);
  272. if (outgoingHostName == null) {
  273. objectOutput.writeUTF(StringPool.BLANK);
  274. }
  275. else {
  276. objectOutput.writeUTF(outgoingHostName);
  277. }
  278. objectOutput.writeInt(outgoingPort);
  279. objectOutput.writeBoolean(outgoingSecure);
  280. if (login == null) {
  281. objectOutput.writeUTF(StringPool.BLANK);
  282. }
  283. else {
  284. objectOutput.writeUTF(login);
  285. }
  286. if (password == null) {
  287. objectOutput.writeUTF(StringPool.BLANK);
  288. }
  289. else {
  290. objectOutput.writeUTF(password);
  291. }
  292. objectOutput.writeBoolean(savePassword);
  293. if (signature == null) {
  294. objectOutput.writeUTF(StringPool.BLANK);
  295. }
  296. else {
  297. objectOutput.writeUTF(signature);
  298. }
  299. objectOutput.writeBoolean(useSignature);
  300. if (folderPrefix == null) {
  301. objectOutput.writeUTF(StringPool.BLANK);
  302. }
  303. else {
  304. objectOutput.writeUTF(folderPrefix);
  305. }
  306. objectOutput.writeLong(inboxFolderId);
  307. objectOutput.writeLong(draftFolderId);
  308. objectOutput.writeLong(sentFolderId);
  309. objectOutput.writeLong(trashFolderId);
  310. objectOutput.writeBoolean(defaultSender);
  311. }
  312. public long accountId;
  313. public long companyId;
  314. public long userId;
  315. public String userName;
  316. public long createDate;
  317. public long modifiedDate;
  318. public String address;
  319. public String personalName;
  320. public String protocol;
  321. public String incomingHostName;
  322. public int incomingPort;
  323. public boolean incomingSecure;
  324. public String outgoingHostName;
  325. public int outgoingPort;
  326. public boolean outgoingSecure;
  327. public String login;
  328. public String password;
  329. public boolean savePassword;
  330. public String signature;
  331. public boolean useSignature;
  332. public String folderPrefix;
  333. public long inboxFolderId;
  334. public long draftFolderId;
  335. public long sentFolderId;
  336. public long trashFolderId;
  337. public boolean defaultSender;
  338. }