001
014
015 package com.liferay.portlet.bookmarks.model.impl;
016
017 import com.liferay.portal.kernel.util.StringBundler;
018 import com.liferay.portal.kernel.util.StringPool;
019 import com.liferay.portal.model.CacheModel;
020
021 import com.liferay.portlet.bookmarks.model.BookmarksEntry;
022
023 import java.io.Serializable;
024
025 import java.util.Date;
026
027
034 public class BookmarksEntryCacheModel implements CacheModel<BookmarksEntry>,
035 Serializable {
036 @Override
037 public String toString() {
038 StringBundler sb = new StringBundler(31);
039
040 sb.append("{uuid=");
041 sb.append(uuid);
042 sb.append(", entryId=");
043 sb.append(entryId);
044 sb.append(", groupId=");
045 sb.append(groupId);
046 sb.append(", companyId=");
047 sb.append(companyId);
048 sb.append(", userId=");
049 sb.append(userId);
050 sb.append(", userName=");
051 sb.append(userName);
052 sb.append(", createDate=");
053 sb.append(createDate);
054 sb.append(", modifiedDate=");
055 sb.append(modifiedDate);
056 sb.append(", resourceBlockId=");
057 sb.append(resourceBlockId);
058 sb.append(", folderId=");
059 sb.append(folderId);
060 sb.append(", name=");
061 sb.append(name);
062 sb.append(", url=");
063 sb.append(url);
064 sb.append(", description=");
065 sb.append(description);
066 sb.append(", visits=");
067 sb.append(visits);
068 sb.append(", priority=");
069 sb.append(priority);
070 sb.append("}");
071
072 return sb.toString();
073 }
074
075 public BookmarksEntry toEntityModel() {
076 BookmarksEntryImpl bookmarksEntryImpl = new BookmarksEntryImpl();
077
078 if (uuid == null) {
079 bookmarksEntryImpl.setUuid(StringPool.BLANK);
080 }
081 else {
082 bookmarksEntryImpl.setUuid(uuid);
083 }
084
085 bookmarksEntryImpl.setEntryId(entryId);
086 bookmarksEntryImpl.setGroupId(groupId);
087 bookmarksEntryImpl.setCompanyId(companyId);
088 bookmarksEntryImpl.setUserId(userId);
089
090 if (userName == null) {
091 bookmarksEntryImpl.setUserName(StringPool.BLANK);
092 }
093 else {
094 bookmarksEntryImpl.setUserName(userName);
095 }
096
097 if (createDate == Long.MIN_VALUE) {
098 bookmarksEntryImpl.setCreateDate(null);
099 }
100 else {
101 bookmarksEntryImpl.setCreateDate(new Date(createDate));
102 }
103
104 if (modifiedDate == Long.MIN_VALUE) {
105 bookmarksEntryImpl.setModifiedDate(null);
106 }
107 else {
108 bookmarksEntryImpl.setModifiedDate(new Date(modifiedDate));
109 }
110
111 bookmarksEntryImpl.setResourceBlockId(resourceBlockId);
112 bookmarksEntryImpl.setFolderId(folderId);
113
114 if (name == null) {
115 bookmarksEntryImpl.setName(StringPool.BLANK);
116 }
117 else {
118 bookmarksEntryImpl.setName(name);
119 }
120
121 if (url == null) {
122 bookmarksEntryImpl.setUrl(StringPool.BLANK);
123 }
124 else {
125 bookmarksEntryImpl.setUrl(url);
126 }
127
128 if (description == null) {
129 bookmarksEntryImpl.setDescription(StringPool.BLANK);
130 }
131 else {
132 bookmarksEntryImpl.setDescription(description);
133 }
134
135 bookmarksEntryImpl.setVisits(visits);
136 bookmarksEntryImpl.setPriority(priority);
137
138 bookmarksEntryImpl.resetOriginalValues();
139
140 return bookmarksEntryImpl;
141 }
142
143 public String uuid;
144 public long entryId;
145 public long groupId;
146 public long companyId;
147 public long userId;
148 public String userName;
149 public long createDate;
150 public long modifiedDate;
151 public long resourceBlockId;
152 public long folderId;
153 public String name;
154 public String url;
155 public String description;
156 public int visits;
157 public int priority;
158 }