1
22
23 package com.liferay.portlet.announcements.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.model.impl.BaseModelImpl;
29
30 import com.liferay.portlet.announcements.model.AnnouncementsFlag;
31 import com.liferay.portlet.announcements.model.AnnouncementsFlagSoap;
32 import com.liferay.portlet.expando.model.ExpandoBridge;
33 import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
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
65 public class AnnouncementsFlagModelImpl extends BaseModelImpl {
66 public static final String TABLE_NAME = "AnnouncementsFlag";
67 public static final Object[][] TABLE_COLUMNS = {
68 { "flagId", new Integer(Types.BIGINT) },
69
70
71 { "userId", new Integer(Types.BIGINT) },
72
73
74 { "createDate", new Integer(Types.TIMESTAMP) },
75
76
77 { "entryId", new Integer(Types.BIGINT) },
78
79
80 { "value", new Integer(Types.INTEGER) }
81 };
82 public static final String TABLE_SQL_CREATE = "create table AnnouncementsFlag (flagId LONG not null primary key,userId LONG,createDate DATE null,entryId LONG,value INTEGER)";
83 public static final String TABLE_SQL_DROP = "drop table AnnouncementsFlag";
84 public static final String DATA_SOURCE = "liferayDataSource";
85 public static final String SESSION_FACTORY = "liferaySessionFactory";
86 public static final String TX_MANAGER = "liferayTransactionManager";
87 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
88 "value.object.finder.cache.enabled.com.liferay.portlet.announcements.model.AnnouncementsFlag"),
89 true);
90
91 public static AnnouncementsFlag toModel(AnnouncementsFlagSoap soapModel) {
92 AnnouncementsFlag model = new AnnouncementsFlagImpl();
93
94 model.setFlagId(soapModel.getFlagId());
95 model.setUserId(soapModel.getUserId());
96 model.setCreateDate(soapModel.getCreateDate());
97 model.setEntryId(soapModel.getEntryId());
98 model.setValue(soapModel.getValue());
99
100 return model;
101 }
102
103 public static List<AnnouncementsFlag> toModels(
104 AnnouncementsFlagSoap[] soapModels) {
105 List<AnnouncementsFlag> models = new ArrayList<AnnouncementsFlag>(soapModels.length);
106
107 for (AnnouncementsFlagSoap soapModel : soapModels) {
108 models.add(toModel(soapModel));
109 }
110
111 return models;
112 }
113
114 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
115 "lock.expiration.time.com.liferay.portlet.announcements.model.AnnouncementsFlag"));
116
117 public AnnouncementsFlagModelImpl() {
118 }
119
120 public long getPrimaryKey() {
121 return _flagId;
122 }
123
124 public void setPrimaryKey(long pk) {
125 setFlagId(pk);
126 }
127
128 public Serializable getPrimaryKeyObj() {
129 return new Long(_flagId);
130 }
131
132 public long getFlagId() {
133 return _flagId;
134 }
135
136 public void setFlagId(long flagId) {
137 if (flagId != _flagId) {
138 _flagId = flagId;
139 }
140 }
141
142 public long getUserId() {
143 return _userId;
144 }
145
146 public void setUserId(long userId) {
147 if (userId != _userId) {
148 _userId = userId;
149 }
150 }
151
152 public Date getCreateDate() {
153 return _createDate;
154 }
155
156 public void setCreateDate(Date createDate) {
157 if (((createDate == null) && (_createDate != null)) ||
158 ((createDate != null) && (_createDate == null)) ||
159 ((createDate != null) && (_createDate != null) &&
160 !createDate.equals(_createDate))) {
161 _createDate = createDate;
162 }
163 }
164
165 public long getEntryId() {
166 return _entryId;
167 }
168
169 public void setEntryId(long entryId) {
170 if (entryId != _entryId) {
171 _entryId = entryId;
172 }
173 }
174
175 public int getValue() {
176 return _value;
177 }
178
179 public void setValue(int value) {
180 if (value != _value) {
181 _value = value;
182 }
183 }
184
185 public AnnouncementsFlag toEscapedModel() {
186 if (isEscapedModel()) {
187 return (AnnouncementsFlag)this;
188 }
189 else {
190 AnnouncementsFlag model = new AnnouncementsFlagImpl();
191
192 model.setNew(isNew());
193 model.setEscapedModel(true);
194
195 model.setFlagId(getFlagId());
196 model.setUserId(getUserId());
197 model.setCreateDate(getCreateDate());
198 model.setEntryId(getEntryId());
199 model.setValue(getValue());
200
201 model = (AnnouncementsFlag)Proxy.newProxyInstance(AnnouncementsFlag.class.getClassLoader(),
202 new Class[] { AnnouncementsFlag.class },
203 new ReadOnlyBeanHandler(model));
204
205 return model;
206 }
207 }
208
209 public ExpandoBridge getExpandoBridge() {
210 if (_expandoBridge == null) {
211 _expandoBridge = new ExpandoBridgeImpl(AnnouncementsFlag.class.getName(),
212 getPrimaryKey());
213 }
214
215 return _expandoBridge;
216 }
217
218 public Object clone() {
219 AnnouncementsFlagImpl clone = new AnnouncementsFlagImpl();
220
221 clone.setFlagId(getFlagId());
222 clone.setUserId(getUserId());
223 clone.setCreateDate(getCreateDate());
224 clone.setEntryId(getEntryId());
225 clone.setValue(getValue());
226
227 return clone;
228 }
229
230 public int compareTo(Object obj) {
231 if (obj == null) {
232 return -1;
233 }
234
235 AnnouncementsFlagImpl announcementsFlag = (AnnouncementsFlagImpl)obj;
236
237 int value = 0;
238
239 if (getUserId() < announcementsFlag.getUserId()) {
240 value = -1;
241 }
242 else if (getUserId() > announcementsFlag.getUserId()) {
243 value = 1;
244 }
245 else {
246 value = 0;
247 }
248
249 if (value != 0) {
250 return value;
251 }
252
253 value = DateUtil.compareTo(getCreateDate(),
254 announcementsFlag.getCreateDate());
255
256 if (value != 0) {
257 return value;
258 }
259
260 return 0;
261 }
262
263 public boolean equals(Object obj) {
264 if (obj == null) {
265 return false;
266 }
267
268 AnnouncementsFlagImpl announcementsFlag = null;
269
270 try {
271 announcementsFlag = (AnnouncementsFlagImpl)obj;
272 }
273 catch (ClassCastException cce) {
274 return false;
275 }
276
277 long pk = announcementsFlag.getPrimaryKey();
278
279 if (getPrimaryKey() == pk) {
280 return true;
281 }
282 else {
283 return false;
284 }
285 }
286
287 public int hashCode() {
288 return (int)getPrimaryKey();
289 }
290
291 private long _flagId;
292 private long _userId;
293 private Date _createDate;
294 private long _entryId;
295 private int _value;
296 private transient ExpandoBridge _expandoBridge;
297 }