1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.kernel.util.StringPool;
29 import com.liferay.portal.model.PortletItem;
30 import com.liferay.portal.model.PortletItemSoap;
31 import com.liferay.portal.util.PortalUtil;
32
33 import java.io.Serializable;
34
35 import java.lang.reflect.Proxy;
36
37 import java.sql.Types;
38
39 import java.util.ArrayList;
40 import java.util.Date;
41 import java.util.List;
42
43
63 public class PortletItemModelImpl extends BaseModelImpl {
64 public static final String TABLE_NAME = "PortletItem";
65 public static final Object[][] TABLE_COLUMNS = {
66 { "portletItemId", new Integer(Types.BIGINT) },
67
68
69 { "groupId", new Integer(Types.BIGINT) },
70
71
72 { "companyId", new Integer(Types.BIGINT) },
73
74
75 { "userId", new Integer(Types.BIGINT) },
76
77
78 { "userName", new Integer(Types.VARCHAR) },
79
80
81 { "createDate", new Integer(Types.TIMESTAMP) },
82
83
84 { "modifiedDate", new Integer(Types.TIMESTAMP) },
85
86
87 { "name", new Integer(Types.VARCHAR) },
88
89
90 { "portletId", new Integer(Types.VARCHAR) },
91
92
93 { "classNameId", new Integer(Types.BIGINT) }
94 };
95 public static final String TABLE_SQL_CREATE = "create table PortletItem (portletItemId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,name VARCHAR(75) null,portletId VARCHAR(75) null,classNameId LONG)";
96 public static final String TABLE_SQL_DROP = "drop table PortletItem";
97 public static final String DATA_SOURCE = "liferayDataSource";
98 public static final String SESSION_FACTORY = "liferaySessionFactory";
99 public static final String TX_MANAGER = "liferayTransactionManager";
100 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
101 "value.object.finder.cache.enabled.com.liferay.portal.model.PortletItem"),
102 true);
103
104 public static PortletItem toModel(PortletItemSoap soapModel) {
105 PortletItem model = new PortletItemImpl();
106
107 model.setPortletItemId(soapModel.getPortletItemId());
108 model.setGroupId(soapModel.getGroupId());
109 model.setCompanyId(soapModel.getCompanyId());
110 model.setUserId(soapModel.getUserId());
111 model.setUserName(soapModel.getUserName());
112 model.setCreateDate(soapModel.getCreateDate());
113 model.setModifiedDate(soapModel.getModifiedDate());
114 model.setName(soapModel.getName());
115 model.setPortletId(soapModel.getPortletId());
116 model.setClassNameId(soapModel.getClassNameId());
117
118 return model;
119 }
120
121 public static List<PortletItem> toModels(PortletItemSoap[] soapModels) {
122 List<PortletItem> models = new ArrayList<PortletItem>(soapModels.length);
123
124 for (PortletItemSoap soapModel : soapModels) {
125 models.add(toModel(soapModel));
126 }
127
128 return models;
129 }
130
131 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
132 "lock.expiration.time.com.liferay.portal.model.PortletItem"));
133
134 public PortletItemModelImpl() {
135 }
136
137 public long getPrimaryKey() {
138 return _portletItemId;
139 }
140
141 public void setPrimaryKey(long pk) {
142 setPortletItemId(pk);
143 }
144
145 public Serializable getPrimaryKeyObj() {
146 return new Long(_portletItemId);
147 }
148
149 public long getPortletItemId() {
150 return _portletItemId;
151 }
152
153 public void setPortletItemId(long portletItemId) {
154 if (portletItemId != _portletItemId) {
155 _portletItemId = portletItemId;
156 }
157 }
158
159 public long getGroupId() {
160 return _groupId;
161 }
162
163 public void setGroupId(long groupId) {
164 if (groupId != _groupId) {
165 _groupId = groupId;
166 }
167 }
168
169 public long getCompanyId() {
170 return _companyId;
171 }
172
173 public void setCompanyId(long companyId) {
174 if (companyId != _companyId) {
175 _companyId = companyId;
176 }
177 }
178
179 public long getUserId() {
180 return _userId;
181 }
182
183 public void setUserId(long userId) {
184 if (userId != _userId) {
185 _userId = userId;
186 }
187 }
188
189 public String getUserName() {
190 return GetterUtil.getString(_userName);
191 }
192
193 public void setUserName(String userName) {
194 if (((userName == null) && (_userName != null)) ||
195 ((userName != null) && (_userName == null)) ||
196 ((userName != null) && (_userName != null) &&
197 !userName.equals(_userName))) {
198 _userName = userName;
199 }
200 }
201
202 public Date getCreateDate() {
203 return _createDate;
204 }
205
206 public void setCreateDate(Date createDate) {
207 if (((createDate == null) && (_createDate != null)) ||
208 ((createDate != null) && (_createDate == null)) ||
209 ((createDate != null) && (_createDate != null) &&
210 !createDate.equals(_createDate))) {
211 _createDate = createDate;
212 }
213 }
214
215 public Date getModifiedDate() {
216 return _modifiedDate;
217 }
218
219 public void setModifiedDate(Date modifiedDate) {
220 if (((modifiedDate == null) && (_modifiedDate != null)) ||
221 ((modifiedDate != null) && (_modifiedDate == null)) ||
222 ((modifiedDate != null) && (_modifiedDate != null) &&
223 !modifiedDate.equals(_modifiedDate))) {
224 _modifiedDate = modifiedDate;
225 }
226 }
227
228 public String getName() {
229 return GetterUtil.getString(_name);
230 }
231
232 public void setName(String name) {
233 if (((name == null) && (_name != null)) ||
234 ((name != null) && (_name == null)) ||
235 ((name != null) && (_name != null) && !name.equals(_name))) {
236 _name = name;
237 }
238 }
239
240 public String getPortletId() {
241 return GetterUtil.getString(_portletId);
242 }
243
244 public void setPortletId(String portletId) {
245 if (((portletId == null) && (_portletId != null)) ||
246 ((portletId != null) && (_portletId == null)) ||
247 ((portletId != null) && (_portletId != null) &&
248 !portletId.equals(_portletId))) {
249 _portletId = portletId;
250 }
251 }
252
253 public String getClassName() {
254 if (getClassNameId() <= 0) {
255 return StringPool.BLANK;
256 }
257
258 return PortalUtil.getClassName(getClassNameId());
259 }
260
261 public long getClassNameId() {
262 return _classNameId;
263 }
264
265 public void setClassNameId(long classNameId) {
266 if (classNameId != _classNameId) {
267 _classNameId = classNameId;
268 }
269 }
270
271 public PortletItem toEscapedModel() {
272 if (isEscapedModel()) {
273 return (PortletItem)this;
274 }
275 else {
276 PortletItem model = new PortletItemImpl();
277
278 model.setNew(isNew());
279 model.setEscapedModel(true);
280
281 model.setPortletItemId(getPortletItemId());
282 model.setGroupId(getGroupId());
283 model.setCompanyId(getCompanyId());
284 model.setUserId(getUserId());
285 model.setUserName(HtmlUtil.escape(getUserName()));
286 model.setCreateDate(getCreateDate());
287 model.setModifiedDate(getModifiedDate());
288 model.setName(HtmlUtil.escape(getName()));
289 model.setPortletId(HtmlUtil.escape(getPortletId()));
290 model.setClassNameId(getClassNameId());
291
292 model = (PortletItem)Proxy.newProxyInstance(PortletItem.class.getClassLoader(),
293 new Class[] { PortletItem.class },
294 new ReadOnlyBeanHandler(model));
295
296 return model;
297 }
298 }
299
300 public Object clone() {
301 PortletItemImpl clone = new PortletItemImpl();
302
303 clone.setPortletItemId(getPortletItemId());
304 clone.setGroupId(getGroupId());
305 clone.setCompanyId(getCompanyId());
306 clone.setUserId(getUserId());
307 clone.setUserName(getUserName());
308 clone.setCreateDate(getCreateDate());
309 clone.setModifiedDate(getModifiedDate());
310 clone.setName(getName());
311 clone.setPortletId(getPortletId());
312 clone.setClassNameId(getClassNameId());
313
314 return clone;
315 }
316
317 public int compareTo(Object obj) {
318 if (obj == null) {
319 return -1;
320 }
321
322 PortletItemImpl portletItem = (PortletItemImpl)obj;
323
324 long pk = portletItem.getPrimaryKey();
325
326 if (getPrimaryKey() < pk) {
327 return -1;
328 }
329 else if (getPrimaryKey() > pk) {
330 return 1;
331 }
332 else {
333 return 0;
334 }
335 }
336
337 public boolean equals(Object obj) {
338 if (obj == null) {
339 return false;
340 }
341
342 PortletItemImpl portletItem = null;
343
344 try {
345 portletItem = (PortletItemImpl)obj;
346 }
347 catch (ClassCastException cce) {
348 return false;
349 }
350
351 long pk = portletItem.getPrimaryKey();
352
353 if (getPrimaryKey() == pk) {
354 return true;
355 }
356 else {
357 return false;
358 }
359 }
360
361 public int hashCode() {
362 return (int)getPrimaryKey();
363 }
364
365 private long _portletItemId;
366 private long _groupId;
367 private long _companyId;
368 private long _userId;
369 private String _userName;
370 private Date _createDate;
371 private Date _modifiedDate;
372 private String _name;
373 private String _portletId;
374 private long _classNameId;
375 }