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