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