1
22
23 package com.liferay.portlet.ratings.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.impl.BaseModelImpl;
28 import com.liferay.portal.util.PropsUtil;
29
30 import com.liferay.portlet.ratings.model.RatingsEntry;
31
32 import com.liferay.util.Html;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.Date;
41
42
62 public class RatingsEntryModelImpl extends BaseModelImpl {
63 public static final String TABLE_NAME = "RatingsEntry";
64 public static final Object[][] TABLE_COLUMNS = {
65 { "entryId", new Integer(Types.BIGINT) },
66
67
68 { "companyId", new Integer(Types.BIGINT) },
69
70
71 { "userId", new Integer(Types.BIGINT) },
72
73
74 { "userName", new Integer(Types.VARCHAR) },
75
76
77 { "createDate", new Integer(Types.TIMESTAMP) },
78
79
80 { "modifiedDate", new Integer(Types.TIMESTAMP) },
81
82
83 { "classNameId", new Integer(Types.BIGINT) },
84
85
86 { "classPK", new Integer(Types.BIGINT) },
87
88
89 { "score", new Integer(Types.DOUBLE) }
90 };
91 public static final String TABLE_SQL_CREATE = "create table RatingsEntry (entryId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,score DOUBLE)";
92 public static final String TABLE_SQL_DROP = "drop table RatingsEntry";
93 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
94 "value.object.finder.cache.enabled.com.liferay.portlet.ratings.model.RatingsEntry"),
95 true);
96 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
97 "lock.expiration.time.com.liferay.portlet.ratings.model.RatingsEntry"));
98
99 public RatingsEntryModelImpl() {
100 }
101
102 public long getPrimaryKey() {
103 return _entryId;
104 }
105
106 public void setPrimaryKey(long pk) {
107 setEntryId(pk);
108 }
109
110 public Serializable getPrimaryKeyObj() {
111 return new Long(_entryId);
112 }
113
114 public long getEntryId() {
115 return _entryId;
116 }
117
118 public void setEntryId(long entryId) {
119 if (entryId != _entryId) {
120 _entryId = entryId;
121 }
122 }
123
124 public long getCompanyId() {
125 return _companyId;
126 }
127
128 public void setCompanyId(long companyId) {
129 if (companyId != _companyId) {
130 _companyId = companyId;
131 }
132 }
133
134 public long getUserId() {
135 return _userId;
136 }
137
138 public void setUserId(long userId) {
139 if (userId != _userId) {
140 _userId = userId;
141 }
142 }
143
144 public String getUserName() {
145 return GetterUtil.getString(_userName);
146 }
147
148 public void setUserName(String userName) {
149 if (((userName == null) && (_userName != null)) ||
150 ((userName != null) && (_userName == null)) ||
151 ((userName != null) && (_userName != null) &&
152 !userName.equals(_userName))) {
153 _userName = userName;
154 }
155 }
156
157 public Date getCreateDate() {
158 return _createDate;
159 }
160
161 public void setCreateDate(Date createDate) {
162 if (((createDate == null) && (_createDate != null)) ||
163 ((createDate != null) && (_createDate == null)) ||
164 ((createDate != null) && (_createDate != null) &&
165 !createDate.equals(_createDate))) {
166 _createDate = createDate;
167 }
168 }
169
170 public Date getModifiedDate() {
171 return _modifiedDate;
172 }
173
174 public void setModifiedDate(Date modifiedDate) {
175 if (((modifiedDate == null) && (_modifiedDate != null)) ||
176 ((modifiedDate != null) && (_modifiedDate == null)) ||
177 ((modifiedDate != null) && (_modifiedDate != null) &&
178 !modifiedDate.equals(_modifiedDate))) {
179 _modifiedDate = modifiedDate;
180 }
181 }
182
183 public long getClassNameId() {
184 return _classNameId;
185 }
186
187 public void setClassNameId(long classNameId) {
188 if (classNameId != _classNameId) {
189 _classNameId = classNameId;
190 }
191 }
192
193 public long getClassPK() {
194 return _classPK;
195 }
196
197 public void setClassPK(long classPK) {
198 if (classPK != _classPK) {
199 _classPK = classPK;
200 }
201 }
202
203 public double getScore() {
204 return _score;
205 }
206
207 public void setScore(double score) {
208 if (score != _score) {
209 _score = score;
210 }
211 }
212
213 public RatingsEntry toEscapedModel() {
214 if (isEscapedModel()) {
215 return (RatingsEntry)this;
216 }
217 else {
218 RatingsEntry model = new RatingsEntryImpl();
219
220 model.setEscapedModel(true);
221
222 model.setEntryId(getEntryId());
223 model.setCompanyId(getCompanyId());
224 model.setUserId(getUserId());
225 model.setUserName(Html.escape(getUserName()));
226 model.setCreateDate(getCreateDate());
227 model.setModifiedDate(getModifiedDate());
228 model.setClassNameId(getClassNameId());
229 model.setClassPK(getClassPK());
230 model.setScore(getScore());
231
232 model = (RatingsEntry)Proxy.newProxyInstance(RatingsEntry.class.getClassLoader(),
233 new Class[] { RatingsEntry.class },
234 new ReadOnlyBeanHandler(model));
235
236 return model;
237 }
238 }
239
240 public Object clone() {
241 RatingsEntryImpl clone = new RatingsEntryImpl();
242
243 clone.setEntryId(getEntryId());
244 clone.setCompanyId(getCompanyId());
245 clone.setUserId(getUserId());
246 clone.setUserName(getUserName());
247 clone.setCreateDate(getCreateDate());
248 clone.setModifiedDate(getModifiedDate());
249 clone.setClassNameId(getClassNameId());
250 clone.setClassPK(getClassPK());
251 clone.setScore(getScore());
252
253 return clone;
254 }
255
256 public int compareTo(Object obj) {
257 if (obj == null) {
258 return -1;
259 }
260
261 RatingsEntryImpl ratingsEntry = (RatingsEntryImpl)obj;
262
263 long pk = ratingsEntry.getPrimaryKey();
264
265 if (getPrimaryKey() < pk) {
266 return -1;
267 }
268 else if (getPrimaryKey() > pk) {
269 return 1;
270 }
271 else {
272 return 0;
273 }
274 }
275
276 public boolean equals(Object obj) {
277 if (obj == null) {
278 return false;
279 }
280
281 RatingsEntryImpl ratingsEntry = null;
282
283 try {
284 ratingsEntry = (RatingsEntryImpl)obj;
285 }
286 catch (ClassCastException cce) {
287 return false;
288 }
289
290 long pk = ratingsEntry.getPrimaryKey();
291
292 if (getPrimaryKey() == pk) {
293 return true;
294 }
295 else {
296 return false;
297 }
298 }
299
300 public int hashCode() {
301 return (int)getPrimaryKey();
302 }
303
304 private long _entryId;
305 private long _companyId;
306 private long _userId;
307 private String _userName;
308 private Date _createDate;
309 private Date _modifiedDate;
310 private long _classNameId;
311 private long _classPK;
312 private double _score;
313 }