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