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