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