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