001
014
015 package com.liferay.portlet.messageboards.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.GetterUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.model.impl.BaseModelImpl;
022 import com.liferay.portal.service.ServiceContext;
023 import com.liferay.portal.util.PortalUtil;
024
025 import com.liferay.portlet.expando.model.ExpandoBridge;
026 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
027 import com.liferay.portlet.messageboards.model.MBMessageFlag;
028 import com.liferay.portlet.messageboards.model.MBMessageFlagModel;
029 import com.liferay.portlet.messageboards.model.MBMessageFlagSoap;
030
031 import java.io.Serializable;
032
033 import java.lang.reflect.Proxy;
034
035 import java.sql.Types;
036
037 import java.util.ArrayList;
038 import java.util.Date;
039 import java.util.List;
040
041
058 public class MBMessageFlagModelImpl extends BaseModelImpl<MBMessageFlag>
059 implements MBMessageFlagModel {
060 public static final String TABLE_NAME = "MBMessageFlag";
061 public static final Object[][] TABLE_COLUMNS = {
062 { "messageFlagId", new Integer(Types.BIGINT) },
063 { "userId", new Integer(Types.BIGINT) },
064 { "modifiedDate", new Integer(Types.TIMESTAMP) },
065 { "threadId", new Integer(Types.BIGINT) },
066 { "messageId", new Integer(Types.BIGINT) },
067 { "flag", new Integer(Types.INTEGER) }
068 };
069 public static final String TABLE_SQL_CREATE = "create table MBMessageFlag (messageFlagId LONG not null primary key,userId LONG,modifiedDate DATE null,threadId LONG,messageId LONG,flag INTEGER)";
070 public static final String TABLE_SQL_DROP = "drop table MBMessageFlag";
071 public static final String DATA_SOURCE = "liferayDataSource";
072 public static final String SESSION_FACTORY = "liferaySessionFactory";
073 public static final String TX_MANAGER = "liferayTransactionManager";
074 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
075 "value.object.entity.cache.enabled.com.liferay.portlet.messageboards.model.MBMessageFlag"),
076 true);
077 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
078 "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBMessageFlag"),
079 true);
080
081
087 public static MBMessageFlag toModel(MBMessageFlagSoap soapModel) {
088 MBMessageFlag model = new MBMessageFlagImpl();
089
090 model.setMessageFlagId(soapModel.getMessageFlagId());
091 model.setUserId(soapModel.getUserId());
092 model.setModifiedDate(soapModel.getModifiedDate());
093 model.setThreadId(soapModel.getThreadId());
094 model.setMessageId(soapModel.getMessageId());
095 model.setFlag(soapModel.getFlag());
096
097 return model;
098 }
099
100
106 public static List<MBMessageFlag> toModels(MBMessageFlagSoap[] soapModels) {
107 List<MBMessageFlag> models = new ArrayList<MBMessageFlag>(soapModels.length);
108
109 for (MBMessageFlagSoap soapModel : soapModels) {
110 models.add(toModel(soapModel));
111 }
112
113 return models;
114 }
115
116 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
117 "lock.expiration.time.com.liferay.portlet.messageboards.model.MBMessageFlag"));
118
119 public MBMessageFlagModelImpl() {
120 }
121
122 public long getPrimaryKey() {
123 return _messageFlagId;
124 }
125
126 public void setPrimaryKey(long pk) {
127 setMessageFlagId(pk);
128 }
129
130 public Serializable getPrimaryKeyObj() {
131 return new Long(_messageFlagId);
132 }
133
134 public long getMessageFlagId() {
135 return _messageFlagId;
136 }
137
138 public void setMessageFlagId(long messageFlagId) {
139 _messageFlagId = messageFlagId;
140 }
141
142 public long getUserId() {
143 return _userId;
144 }
145
146 public void setUserId(long userId) {
147 _userId = userId;
148
149 if (!_setOriginalUserId) {
150 _setOriginalUserId = true;
151
152 _originalUserId = userId;
153 }
154 }
155
156 public String getUserUuid() throws SystemException {
157 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
158 }
159
160 public void setUserUuid(String userUuid) {
161 _userUuid = userUuid;
162 }
163
164 public long getOriginalUserId() {
165 return _originalUserId;
166 }
167
168 public Date getModifiedDate() {
169 return _modifiedDate;
170 }
171
172 public void setModifiedDate(Date modifiedDate) {
173 _modifiedDate = modifiedDate;
174 }
175
176 public long getThreadId() {
177 return _threadId;
178 }
179
180 public void setThreadId(long threadId) {
181 _threadId = threadId;
182 }
183
184 public long getMessageId() {
185 return _messageId;
186 }
187
188 public void setMessageId(long messageId) {
189 _messageId = messageId;
190
191 if (!_setOriginalMessageId) {
192 _setOriginalMessageId = true;
193
194 _originalMessageId = messageId;
195 }
196 }
197
198 public long getOriginalMessageId() {
199 return _originalMessageId;
200 }
201
202 public int getFlag() {
203 return _flag;
204 }
205
206 public void setFlag(int flag) {
207 _flag = flag;
208
209 if (!_setOriginalFlag) {
210 _setOriginalFlag = true;
211
212 _originalFlag = flag;
213 }
214 }
215
216 public int getOriginalFlag() {
217 return _originalFlag;
218 }
219
220 public MBMessageFlag toEscapedModel() {
221 if (isEscapedModel()) {
222 return (MBMessageFlag)this;
223 }
224 else {
225 return (MBMessageFlag)Proxy.newProxyInstance(MBMessageFlag.class.getClassLoader(),
226 new Class[] { MBMessageFlag.class },
227 new AutoEscapeBeanHandler(this));
228 }
229 }
230
231 public ExpandoBridge getExpandoBridge() {
232 if (_expandoBridge == null) {
233 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
234 MBMessageFlag.class.getName(), getPrimaryKey());
235 }
236
237 return _expandoBridge;
238 }
239
240 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
241 getExpandoBridge().setAttributes(serviceContext);
242 }
243
244 public Object clone() {
245 MBMessageFlagImpl clone = new MBMessageFlagImpl();
246
247 clone.setMessageFlagId(getMessageFlagId());
248 clone.setUserId(getUserId());
249 clone.setModifiedDate(getModifiedDate());
250 clone.setThreadId(getThreadId());
251 clone.setMessageId(getMessageId());
252 clone.setFlag(getFlag());
253
254 return clone;
255 }
256
257 public int compareTo(MBMessageFlag mbMessageFlag) {
258 long pk = mbMessageFlag.getPrimaryKey();
259
260 if (getPrimaryKey() < pk) {
261 return -1;
262 }
263 else if (getPrimaryKey() > pk) {
264 return 1;
265 }
266 else {
267 return 0;
268 }
269 }
270
271 public boolean equals(Object obj) {
272 if (obj == null) {
273 return false;
274 }
275
276 MBMessageFlag mbMessageFlag = null;
277
278 try {
279 mbMessageFlag = (MBMessageFlag)obj;
280 }
281 catch (ClassCastException cce) {
282 return false;
283 }
284
285 long pk = mbMessageFlag.getPrimaryKey();
286
287 if (getPrimaryKey() == pk) {
288 return true;
289 }
290 else {
291 return false;
292 }
293 }
294
295 public int hashCode() {
296 return (int)getPrimaryKey();
297 }
298
299 public String toString() {
300 StringBundler sb = new StringBundler(13);
301
302 sb.append("{messageFlagId=");
303 sb.append(getMessageFlagId());
304 sb.append(", userId=");
305 sb.append(getUserId());
306 sb.append(", modifiedDate=");
307 sb.append(getModifiedDate());
308 sb.append(", threadId=");
309 sb.append(getThreadId());
310 sb.append(", messageId=");
311 sb.append(getMessageId());
312 sb.append(", flag=");
313 sb.append(getFlag());
314 sb.append("}");
315
316 return sb.toString();
317 }
318
319 public String toXmlString() {
320 StringBundler sb = new StringBundler(22);
321
322 sb.append("<model><model-name>");
323 sb.append("com.liferay.portlet.messageboards.model.MBMessageFlag");
324 sb.append("</model-name>");
325
326 sb.append(
327 "<column><column-name>messageFlagId</column-name><column-value><![CDATA[");
328 sb.append(getMessageFlagId());
329 sb.append("]]></column-value></column>");
330 sb.append(
331 "<column><column-name>userId</column-name><column-value><![CDATA[");
332 sb.append(getUserId());
333 sb.append("]]></column-value></column>");
334 sb.append(
335 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
336 sb.append(getModifiedDate());
337 sb.append("]]></column-value></column>");
338 sb.append(
339 "<column><column-name>threadId</column-name><column-value><![CDATA[");
340 sb.append(getThreadId());
341 sb.append("]]></column-value></column>");
342 sb.append(
343 "<column><column-name>messageId</column-name><column-value><![CDATA[");
344 sb.append(getMessageId());
345 sb.append("]]></column-value></column>");
346 sb.append(
347 "<column><column-name>flag</column-name><column-value><![CDATA[");
348 sb.append(getFlag());
349 sb.append("]]></column-value></column>");
350
351 sb.append("</model>");
352
353 return sb.toString();
354 }
355
356 private long _messageFlagId;
357 private long _userId;
358 private String _userUuid;
359 private long _originalUserId;
360 private boolean _setOriginalUserId;
361 private Date _modifiedDate;
362 private long _threadId;
363 private long _messageId;
364 private long _originalMessageId;
365 private boolean _setOriginalMessageId;
366 private int _flag;
367 private int _originalFlag;
368 private boolean _setOriginalFlag;
369 private transient ExpandoBridge _expandoBridge;
370 }