PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/apps/collaboration/wiki/wiki-service/src/main/java/com/liferay/wiki/model/impl/WikiPageCacheModel.java

http://github.com/liferay/liferay-portal
Java | 398 lines | 306 code | 72 blank | 20 comment | 71 complexity | 468d02110241a67796788bcda9a0cc7d 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.wiki.model.impl;
  15. import aQute.bnd.annotation.ProviderType;
  16. import com.liferay.portal.kernel.model.CacheModel;
  17. import com.liferay.portal.kernel.util.HashUtil;
  18. import com.liferay.portal.kernel.util.StringBundler;
  19. import com.liferay.portal.kernel.util.StringPool;
  20. import com.liferay.wiki.model.WikiPage;
  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 WikiPage in entity cache.
  28. *
  29. * @author Brian Wing Shun Chan
  30. * @see WikiPage
  31. * @generated
  32. */
  33. @ProviderType
  34. public class WikiPageCacheModel implements CacheModel<WikiPage>, Externalizable {
  35. @Override
  36. public boolean equals(Object obj) {
  37. if (this == obj) {
  38. return true;
  39. }
  40. if (!(obj instanceof WikiPageCacheModel)) {
  41. return false;
  42. }
  43. WikiPageCacheModel wikiPageCacheModel = (WikiPageCacheModel)obj;
  44. if (pageId == wikiPageCacheModel.pageId) {
  45. return true;
  46. }
  47. return false;
  48. }
  49. @Override
  50. public int hashCode() {
  51. return HashUtil.hash(0, pageId);
  52. }
  53. @Override
  54. public String toString() {
  55. StringBundler sb = new StringBundler(49);
  56. sb.append("{uuid=");
  57. sb.append(uuid);
  58. sb.append(", pageId=");
  59. sb.append(pageId);
  60. sb.append(", resourcePrimKey=");
  61. sb.append(resourcePrimKey);
  62. sb.append(", groupId=");
  63. sb.append(groupId);
  64. sb.append(", companyId=");
  65. sb.append(companyId);
  66. sb.append(", userId=");
  67. sb.append(userId);
  68. sb.append(", userName=");
  69. sb.append(userName);
  70. sb.append(", createDate=");
  71. sb.append(createDate);
  72. sb.append(", modifiedDate=");
  73. sb.append(modifiedDate);
  74. sb.append(", nodeId=");
  75. sb.append(nodeId);
  76. sb.append(", title=");
  77. sb.append(title);
  78. sb.append(", version=");
  79. sb.append(version);
  80. sb.append(", minorEdit=");
  81. sb.append(minorEdit);
  82. sb.append(", content=");
  83. sb.append(content);
  84. sb.append(", summary=");
  85. sb.append(summary);
  86. sb.append(", format=");
  87. sb.append(format);
  88. sb.append(", head=");
  89. sb.append(head);
  90. sb.append(", parentTitle=");
  91. sb.append(parentTitle);
  92. sb.append(", redirectTitle=");
  93. sb.append(redirectTitle);
  94. sb.append(", lastPublishDate=");
  95. sb.append(lastPublishDate);
  96. sb.append(", status=");
  97. sb.append(status);
  98. sb.append(", statusByUserId=");
  99. sb.append(statusByUserId);
  100. sb.append(", statusByUserName=");
  101. sb.append(statusByUserName);
  102. sb.append(", statusDate=");
  103. sb.append(statusDate);
  104. sb.append("}");
  105. return sb.toString();
  106. }
  107. @Override
  108. public WikiPage toEntityModel() {
  109. WikiPageImpl wikiPageImpl = new WikiPageImpl();
  110. if (uuid == null) {
  111. wikiPageImpl.setUuid(StringPool.BLANK);
  112. }
  113. else {
  114. wikiPageImpl.setUuid(uuid);
  115. }
  116. wikiPageImpl.setPageId(pageId);
  117. wikiPageImpl.setResourcePrimKey(resourcePrimKey);
  118. wikiPageImpl.setGroupId(groupId);
  119. wikiPageImpl.setCompanyId(companyId);
  120. wikiPageImpl.setUserId(userId);
  121. if (userName == null) {
  122. wikiPageImpl.setUserName(StringPool.BLANK);
  123. }
  124. else {
  125. wikiPageImpl.setUserName(userName);
  126. }
  127. if (createDate == Long.MIN_VALUE) {
  128. wikiPageImpl.setCreateDate(null);
  129. }
  130. else {
  131. wikiPageImpl.setCreateDate(new Date(createDate));
  132. }
  133. if (modifiedDate == Long.MIN_VALUE) {
  134. wikiPageImpl.setModifiedDate(null);
  135. }
  136. else {
  137. wikiPageImpl.setModifiedDate(new Date(modifiedDate));
  138. }
  139. wikiPageImpl.setNodeId(nodeId);
  140. if (title == null) {
  141. wikiPageImpl.setTitle(StringPool.BLANK);
  142. }
  143. else {
  144. wikiPageImpl.setTitle(title);
  145. }
  146. wikiPageImpl.setVersion(version);
  147. wikiPageImpl.setMinorEdit(minorEdit);
  148. if (content == null) {
  149. wikiPageImpl.setContent(StringPool.BLANK);
  150. }
  151. else {
  152. wikiPageImpl.setContent(content);
  153. }
  154. if (summary == null) {
  155. wikiPageImpl.setSummary(StringPool.BLANK);
  156. }
  157. else {
  158. wikiPageImpl.setSummary(summary);
  159. }
  160. if (format == null) {
  161. wikiPageImpl.setFormat(StringPool.BLANK);
  162. }
  163. else {
  164. wikiPageImpl.setFormat(format);
  165. }
  166. wikiPageImpl.setHead(head);
  167. if (parentTitle == null) {
  168. wikiPageImpl.setParentTitle(StringPool.BLANK);
  169. }
  170. else {
  171. wikiPageImpl.setParentTitle(parentTitle);
  172. }
  173. if (redirectTitle == null) {
  174. wikiPageImpl.setRedirectTitle(StringPool.BLANK);
  175. }
  176. else {
  177. wikiPageImpl.setRedirectTitle(redirectTitle);
  178. }
  179. if (lastPublishDate == Long.MIN_VALUE) {
  180. wikiPageImpl.setLastPublishDate(null);
  181. }
  182. else {
  183. wikiPageImpl.setLastPublishDate(new Date(lastPublishDate));
  184. }
  185. wikiPageImpl.setStatus(status);
  186. wikiPageImpl.setStatusByUserId(statusByUserId);
  187. if (statusByUserName == null) {
  188. wikiPageImpl.setStatusByUserName(StringPool.BLANK);
  189. }
  190. else {
  191. wikiPageImpl.setStatusByUserName(statusByUserName);
  192. }
  193. if (statusDate == Long.MIN_VALUE) {
  194. wikiPageImpl.setStatusDate(null);
  195. }
  196. else {
  197. wikiPageImpl.setStatusDate(new Date(statusDate));
  198. }
  199. wikiPageImpl.resetOriginalValues();
  200. return wikiPageImpl;
  201. }
  202. @Override
  203. public void readExternal(ObjectInput objectInput) throws IOException {
  204. uuid = objectInput.readUTF();
  205. pageId = objectInput.readLong();
  206. resourcePrimKey = objectInput.readLong();
  207. groupId = objectInput.readLong();
  208. companyId = objectInput.readLong();
  209. userId = objectInput.readLong();
  210. userName = objectInput.readUTF();
  211. createDate = objectInput.readLong();
  212. modifiedDate = objectInput.readLong();
  213. nodeId = objectInput.readLong();
  214. title = objectInput.readUTF();
  215. version = objectInput.readDouble();
  216. minorEdit = objectInput.readBoolean();
  217. content = objectInput.readUTF();
  218. summary = objectInput.readUTF();
  219. format = objectInput.readUTF();
  220. head = objectInput.readBoolean();
  221. parentTitle = objectInput.readUTF();
  222. redirectTitle = objectInput.readUTF();
  223. lastPublishDate = objectInput.readLong();
  224. status = objectInput.readInt();
  225. statusByUserId = objectInput.readLong();
  226. statusByUserName = objectInput.readUTF();
  227. statusDate = objectInput.readLong();
  228. }
  229. @Override
  230. public void writeExternal(ObjectOutput objectOutput)
  231. throws IOException {
  232. if (uuid == null) {
  233. objectOutput.writeUTF(StringPool.BLANK);
  234. }
  235. else {
  236. objectOutput.writeUTF(uuid);
  237. }
  238. objectOutput.writeLong(pageId);
  239. objectOutput.writeLong(resourcePrimKey);
  240. objectOutput.writeLong(groupId);
  241. objectOutput.writeLong(companyId);
  242. objectOutput.writeLong(userId);
  243. if (userName == null) {
  244. objectOutput.writeUTF(StringPool.BLANK);
  245. }
  246. else {
  247. objectOutput.writeUTF(userName);
  248. }
  249. objectOutput.writeLong(createDate);
  250. objectOutput.writeLong(modifiedDate);
  251. objectOutput.writeLong(nodeId);
  252. if (title == null) {
  253. objectOutput.writeUTF(StringPool.BLANK);
  254. }
  255. else {
  256. objectOutput.writeUTF(title);
  257. }
  258. objectOutput.writeDouble(version);
  259. objectOutput.writeBoolean(minorEdit);
  260. if (content == null) {
  261. objectOutput.writeUTF(StringPool.BLANK);
  262. }
  263. else {
  264. objectOutput.writeUTF(content);
  265. }
  266. if (summary == null) {
  267. objectOutput.writeUTF(StringPool.BLANK);
  268. }
  269. else {
  270. objectOutput.writeUTF(summary);
  271. }
  272. if (format == null) {
  273. objectOutput.writeUTF(StringPool.BLANK);
  274. }
  275. else {
  276. objectOutput.writeUTF(format);
  277. }
  278. objectOutput.writeBoolean(head);
  279. if (parentTitle == null) {
  280. objectOutput.writeUTF(StringPool.BLANK);
  281. }
  282. else {
  283. objectOutput.writeUTF(parentTitle);
  284. }
  285. if (redirectTitle == null) {
  286. objectOutput.writeUTF(StringPool.BLANK);
  287. }
  288. else {
  289. objectOutput.writeUTF(redirectTitle);
  290. }
  291. objectOutput.writeLong(lastPublishDate);
  292. objectOutput.writeInt(status);
  293. objectOutput.writeLong(statusByUserId);
  294. if (statusByUserName == null) {
  295. objectOutput.writeUTF(StringPool.BLANK);
  296. }
  297. else {
  298. objectOutput.writeUTF(statusByUserName);
  299. }
  300. objectOutput.writeLong(statusDate);
  301. }
  302. public String uuid;
  303. public long pageId;
  304. public long resourcePrimKey;
  305. public long groupId;
  306. public long companyId;
  307. public long userId;
  308. public String userName;
  309. public long createDate;
  310. public long modifiedDate;
  311. public long nodeId;
  312. public String title;
  313. public double version;
  314. public boolean minorEdit;
  315. public String content;
  316. public String summary;
  317. public String format;
  318. public boolean head;
  319. public String parentTitle;
  320. public String redirectTitle;
  321. public long lastPublishDate;
  322. public int status;
  323. public long statusByUserId;
  324. public String statusByUserName;
  325. public long statusDate;
  326. }