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